Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Attributes

vl::DrawElements< arr_type > Class Template Reference

Wrapper for the OpenGL function glDrawElements(). More...

#include <DrawElements.hpp>

Inheritance diagram for vl::DrawElements< arr_type >:
vl::DrawElementsBase vl::DrawCall vl::Object

List of all members.

Classes

class  Triangle

Public Types

typedef arr_type::scalar_type index_type

Public Member Functions

virtual unsigned int primitiveRestartIndex ()
 Returns the primitive restart index used by the draw call or 0 if primitive restart is not supported.
 DrawElements (EPrimitiveType primitive=PT_TRIANGLES, int instances=1)
 Constructor.
DrawElementsoperator= (const DrawElements &other)
 Assign operator.
virtual ref< DrawCallclone () const
 Returns a clone of this DrawCall.
void setCount (i32 count)
 The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'.
i32 count () const
 The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'.
void setOffset (u32 offset)
 The offset in bytes from which the index buffer will be read.
u32 offset () const
 The offset in bytes from which the index buffer will be read.
void setIndexBuffer (arr_type *index_buffer)
 The BufferObject containing the indices used to render.
arr_type * indexBuffer ()
 The BufferObject containing the indices used to render.
const arr_type * indexBuffer () const
 The BufferObject containing the indices used to render.
virtual void updateDirtyBufferObject (EBufferObjectUpdateMode mode)
 Updates the index buffer's BufferObject if marked as dirty.
virtual void deleteBufferObject ()
 Deletes the index buffer's BufferObject.
virtual void render (bool use_bo) const
 Executes the draw call.
TriangleIterator triangleIterator () const
 Returns a TriangleIterator used to iterate through the triangles of a DrawCall.
IndexIterator indexIterator () const
 Returns a IndexIterator used to iterate through the virtual indices of a DrawCall.

Static Public Attributes

static const index_type primitive_restart_index = index_type(~0)
 The special index which identifies a primitive restart. By default it is set to ~0 that is 0xFF, 0xFFFF, 0xFFFFFFFF respectively for GLubyte, GLushort, GLuint index types. */.

Protected Attributes

ref< arr_type > mIndexBuffer
i32 mCount
u32 mOffset

Detailed Description

template<class arr_type>
class vl::DrawElements< arr_type >

Wrapper for the OpenGL function glDrawElements().

See vl::DrawCall for an overview of the different draw call methods.

This class wraps the following OpenGL functions:

Supports:

Use the functions setInstances() and instances() to use the Multi instancing functionality. (requires OpenGL 3.1). For more information see http://www.opengl.org/sdk/docs/man3/xhtml/glDrawElementsInstanced.xml

Use the functions setPrimitiveRestartIndex() and setPrimitiveRestartEnabled() to use the primitive restart functionality (requires OpenGL 3.1). For more information see http://www.opengl.org/sdk/docs/man3/xhtml/glPrimitiveRestartIndex.xml

Use the function setBaseVertex() with a non zero argument to use the base vertex functionality. Requires OpenGL 3.2 or GL_ARB_draw_elements_base_vertex. For more information see http://www.opengl.org/sdk/docs/man3/xhtml/glDrawElementsBaseVertex.xml

DrawElements, MultiDrawElements, DrawRangeElements, DrawArrays are used by Geometry to define a set of primitives to be rendered, see Geometry::drawCalls(). The indices are stored in a BufferObject and thus they can be stored locally or on the GPU. To gain direct access to the BufferObject use the indexBuffer() function.

DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements are used by Geometry to define a set of primitives to be rendered.

See also:
Geometry::drawCalls(), DrawCall, DrawElements, MultiDrawElements, DrawRangeElements, Geometry, Actor

Definition at line 118 of file DrawElements.hpp.


Member Typedef Documentation

template<class arr_type>
typedef arr_type::scalar_type vl::DrawElements< arr_type >::index_type

Definition at line 123 of file DrawElements.hpp.


Constructor & Destructor Documentation

template<class arr_type>
vl::DrawElements< arr_type >::DrawElements ( EPrimitiveType  primitive = PT_TRIANGLES,
int  instances = 1 
) [inline]

Constructor.

Definition at line 155 of file DrawElements.hpp.

Referenced by vl::DrawElements< ArrayUShort1 >::clone().


Member Function Documentation

template<class arr_type>
virtual unsigned int vl::DrawElements< arr_type >::primitiveRestartIndex (  ) [inline, virtual]

Returns the primitive restart index used by the draw call or 0 if primitive restart is not supported.

Reimplemented from vl::DrawCall.

Definition at line 126 of file DrawElements.hpp.

template<class arr_type>
DrawElements& vl::DrawElements< arr_type >::operator= ( const DrawElements< arr_type > &  other ) [inline]

Assign operator.

Definition at line 168 of file DrawElements.hpp.

Referenced by vl::DrawElements< ArrayUShort1 >::operator=().

template<class arr_type>
virtual ref<DrawCall> vl::DrawElements< arr_type >::clone (  ) const [inline, virtual]

Returns a clone of this DrawCall.

Implements vl::DrawCall.

Definition at line 181 of file DrawElements.hpp.

template<class arr_type>
void vl::DrawElements< arr_type >::setCount ( i32  count ) [inline]

The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'.

Definition at line 189 of file DrawElements.hpp.

template<class arr_type>
i32 vl::DrawElements< arr_type >::count (  ) const [inline]

The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'.

Definition at line 192 of file DrawElements.hpp.

Referenced by vl::DrawElements< ArrayUShort1 >::render(), and vl::DrawElements< ArrayUShort1 >::setCount().

template<class arr_type>
void vl::DrawElements< arr_type >::setOffset ( u32  offset ) [inline]

The offset in bytes from which the index buffer will be read.

Definition at line 195 of file DrawElements.hpp.

template<class arr_type>
u32 vl::DrawElements< arr_type >::offset (  ) const [inline]

The offset in bytes from which the index buffer will be read.

Definition at line 198 of file DrawElements.hpp.

Referenced by vl::DrawElements< ArrayUShort1 >::setOffset().

template<class arr_type>
void vl::DrawElements< arr_type >::setIndexBuffer ( arr_type *  index_buffer ) [inline]

The BufferObject containing the indices used to render.

Definition at line 201 of file DrawElements.hpp.

template<class arr_type>
arr_type* vl::DrawElements< arr_type >::indexBuffer (  ) [inline]
template<class arr_type>
const arr_type* vl::DrawElements< arr_type >::indexBuffer (  ) const [inline]

The BufferObject containing the indices used to render.

Definition at line 207 of file DrawElements.hpp.

template<class arr_type>
virtual void vl::DrawElements< arr_type >::updateDirtyBufferObject ( EBufferObjectUpdateMode   ) [inline, virtual]

Updates the index buffer's BufferObject if marked as dirty.

Implements vl::DrawCall.

Definition at line 209 of file DrawElements.hpp.

template<class arr_type>
virtual void vl::DrawElements< arr_type >::deleteBufferObject (  ) [inline, virtual]

Deletes the index buffer's BufferObject.

Implements vl::DrawCall.

Definition at line 215 of file DrawElements.hpp.

template<class arr_type>
virtual void vl::DrawElements< arr_type >::render ( bool  use_bo ) const [inline, virtual]

Executes the draw call.

Implements vl::DrawCall.

Definition at line 220 of file DrawElements.hpp.

template<class arr_type>
TriangleIterator vl::DrawElements< arr_type >::triangleIterator (  ) const [inline, virtual]

Returns a TriangleIterator used to iterate through the triangles of a DrawCall.

Basically the iterator tesselates in triangles any DrawCall of type: PT_TRIANGLES, PT_TRIANGLE_STRIP PT_TRIANGLE_FAN, PT_POLYGON, PT_QUADS, PT_QUAD_STRIP.

Implements vl::DrawCall.

Definition at line 348 of file DrawElements.hpp.

template<class arr_type>
IndexIterator vl::DrawElements< arr_type >::indexIterator (  ) const [inline, virtual]

Returns a IndexIterator used to iterate through the virtual indices of a DrawCall.

This

Note:
The returned indices already take into account primitive restart and base vertex.

Implements vl::DrawCall.

Definition at line 357 of file DrawElements.hpp.


Member Data Documentation

template<class arr_type>
const index_type vl::DrawElements< arr_type >::primitive_restart_index = index_type(~0) [static]

The special index which identifies a primitive restart. By default it is set to ~0 that is 0xFF, 0xFFFF, 0xFFFFFFFF respectively for GLubyte, GLushort, GLuint index types. */.

Definition at line 125 of file DrawElements.hpp.

Referenced by vl::DrawElements< ArrayUShort1 >::indexIterator(), vl::DrawElements< ArrayUShort1 >::primitiveRestartIndex(), vl::DrawElements< ArrayUShort1 >::render(), and vl::DrawElements< ArrayUShort1 >::triangleIterator().

template<class arr_type>
ref< arr_type > vl::DrawElements< arr_type >::mIndexBuffer [protected]
template<class arr_type>
i32 vl::DrawElements< arr_type >::mCount [protected]
template<class arr_type>
u32 vl::DrawElements< arr_type >::mOffset [protected]

The documentation for this class was generated from the following file:

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:09.
Permission is granted to use this page to write and publish articles regarding Visualization Library.