Visualization Library 2.1.0

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 | List of all members
vl::DrawRangeElements< arr_type > Class Template Reference

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

#include <DrawRangeElements.hpp>

+ Inheritance diagram for vl::DrawRangeElements< arr_type >:

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. More...
 
 DrawRangeElements (EPrimitiveType primitive=PT_TRIANGLES, int r_start=0, int r_end=primitive_restart_index)
 
DrawRangeElementsoperator= (const DrawRangeElements &other)
 
virtual ref< DrawCallclone () const
 Returns a clone of the draw call. More...
 
void setCount (i32 count)
 The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'. More...
 
i32 count () const
 The number of indices to render, default is -1 which means 'till the end of the indexBuffer() from offset()'. More...
 
void setOffset (u32 offset)
 The offset in bytes from which the index buffer will be read. More...
 
u32 offset () const
 The offset in bytes from which the index buffer will be read. More...
 
void setIndexBuffer (arr_type *index_buffer)
 The BufferObject containing the indices used to render. More...
 
arr_type * indexBuffer ()
 The BufferObject containing the indices used to render. More...
 
const arr_type * indexBuffer () const
 The BufferObject containing the indices used to render. More...
 
virtual void updateDirtyBufferObject (EBufferObjectUpdateMode mode)
 Updates the index buffer's BufferObject if marked as dirty. More...
 
virtual void deleteBufferObject ()
 Deletes the index buffer's BufferObject. More...
 
virtual void render (bool use_bo) const
 Executes the draw call. More...
 
TriangleIterator triangleIterator () const
 Returns a TriangleIterator used to iterate through the triangles of a DrawCall. More...
 
IndexIterator indexIterator () const
 Returns a IndexIterator used to iterate through the virtual indices of a DrawCall. More...
 
void computeRange ()
 
- Public Member Functions inherited from vl::DrawRangeElementsBase
void setRangeStart (int rstart)
 Sets the range start. More...
 
int rangeStart () const
 Returns the range start. More...
 
void setRangeEnd (int rend)
 Sets the range end. More...
 
int rangeEnd () const
 Returns the range end. More...
 
virtual bool primitiveRestartEnabled () const
 Returns whether the primitive-restart functionality is enabled or not. More...
 
void setPrimitiveRestartEnabled (bool enabled)
 Enables the primitive-restart functionality. More...
 
void setBaseVertex (int base_vertex)
 If base_vertx is != 0 glDrawRangeElementsBaseVertex/glDrawRangeElementsInstancedBaseVertex will be used instead of their non *BaseVertx counterparts. More...
 
int baseVertex () const
 Returns the currently used base vertex. More...
 
- Public Member Functions inherited from vl::DrawCall
 DrawCall ()
 Constructor. More...
 
DrawCalloperator= (const DrawCall &other)
 Assignment operator. More...
 
void setPrimitiveType (EPrimitiveType type)
 Sets the draw call's primitive type. More...
 
EPrimitiveType primitiveType () const
 Returns the draw call's primitive type. More...
 
void setEnabled (bool enable)
 Enables/disables the draw call. More...
 
bool isEnabled () const
 True if the draw call is enabled. More...
 
u32 countIndices () const
 Counts the number of virtual indices of a DrawCall., i.e. More...
 
u32 countTriangles () const
 Counts the number of virtual triangles of a DrawCall., i.e. More...
 
virtual int instances () const
 Returns the number of instances for this set of primitives. More...
 
void setPatchParameter (PatchParameter *patch_param)
 Attach a PatchParameter to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
PatchParameterpatchParameter ()
 The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
const PatchParameterpatchParameter () const
 The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

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. */. More...
 

Protected Attributes

ref< arr_type > mIndexBuffer
 
i32 mCount
 
u32 mOffset
 
- Protected Attributes inherited from vl::DrawRangeElementsBase
int mRangeStart
 
int mRangeEnd
 
GLuint mBaseVertex
 
bool mPrimitiveRestartEnabled
 
- Protected Attributes inherited from vl::DrawCall
ref< PatchParametermPatchParameter
 
EPrimitiveType mType
 
bool mEnabled
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::DrawCall
void applyPatchParameters () const
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

template<class arr_type>
class vl::DrawRangeElements< arr_type >

Wrapper for the OpenGL function glDrawRangeElements().

See also http://www.opengl.org/sdk/docs/man3/xhtml/glDrawRangeElements.xml for more information.

This class wraps the following OpenGL functions:

Supports:

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() 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/glDrawRangeElementsBaseVertex.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 120 of file DrawRangeElements.hpp.

Member Typedef Documentation

◆ index_type

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

Definition at line 125 of file DrawRangeElements.hpp.

Constructor & Destructor Documentation

◆ DrawRangeElements()

template<class arr_type>
vl::DrawRangeElements< arr_type >::DrawRangeElements ( EPrimitiveType  primitive = PT_TRIANGLES,
int  r_start = 0,
int  r_end = primitive_restart_index 
)
inline

Definition at line 156 of file DrawRangeElements.hpp.

Member Function Documentation

◆ clone()

template<class arr_type>
virtual ref<DrawCall> vl::DrawRangeElements< arr_type >::clone ( ) const
inlinevirtual

Returns a clone of the draw call.

Implements vl::DrawCall.

Definition at line 182 of file DrawRangeElements.hpp.

◆ computeRange()

template<class arr_type>
void vl::DrawRangeElements< arr_type >::computeRange ( )
inline

Definition at line 312 of file DrawRangeElements.hpp.

◆ count()

template<class arr_type>
i32 vl::DrawRangeElements< 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 193 of file DrawRangeElements.hpp.

◆ deleteBufferObject()

template<class arr_type>
virtual void vl::DrawRangeElements< arr_type >::deleteBufferObject ( )
inlinevirtual

Deletes the index buffer's BufferObject.

Implements vl::DrawCall.

Definition at line 216 of file DrawRangeElements.hpp.

◆ indexBuffer() [1/2]

template<class arr_type>
arr_type* vl::DrawRangeElements< arr_type >::indexBuffer ( )
inline

The BufferObject containing the indices used to render.

Definition at line 205 of file DrawRangeElements.hpp.

Referenced by vl::DrawRangeElements< ArrayUShort1 >::operator=(), and vl::Geometry::shrinkDrawCalls().

◆ indexBuffer() [2/2]

template<class arr_type>
const arr_type* vl::DrawRangeElements< arr_type >::indexBuffer ( ) const
inline

The BufferObject containing the indices used to render.

Definition at line 208 of file DrawRangeElements.hpp.

◆ indexIterator()

template<class arr_type>
IndexIterator vl::DrawRangeElements< arr_type >::indexIterator ( ) const
inlinevirtual

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 303 of file DrawRangeElements.hpp.

◆ offset()

template<class arr_type>
u32 vl::DrawRangeElements< arr_type >::offset ( ) const
inline

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

Definition at line 199 of file DrawRangeElements.hpp.

◆ operator=()

template<class arr_type>
DrawRangeElements& vl::DrawRangeElements< arr_type >::operator= ( const DrawRangeElements< arr_type > &  other)
inline

Definition at line 169 of file DrawRangeElements.hpp.

◆ primitiveRestartIndex()

template<class arr_type>
virtual unsigned int vl::DrawRangeElements< arr_type >::primitiveRestartIndex ( )
inlinevirtual

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 128 of file DrawRangeElements.hpp.

◆ render()

template<class arr_type>
virtual void vl::DrawRangeElements< arr_type >::render ( bool  use_bo) const
inlinevirtual

Executes the draw call.

Implements vl::DrawCall.

Definition at line 221 of file DrawRangeElements.hpp.

◆ setCount()

template<class arr_type>
void vl::DrawRangeElements< 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 190 of file DrawRangeElements.hpp.

◆ setIndexBuffer()

template<class arr_type>
void vl::DrawRangeElements< arr_type >::setIndexBuffer ( arr_type *  index_buffer)
inline

The BufferObject containing the indices used to render.

Definition at line 202 of file DrawRangeElements.hpp.

◆ setOffset()

template<class arr_type>
void vl::DrawRangeElements< arr_type >::setOffset ( u32  offset)
inline

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

Definition at line 196 of file DrawRangeElements.hpp.

◆ triangleIterator()

template<class arr_type>
TriangleIterator vl::DrawRangeElements< arr_type >::triangleIterator ( ) const
inlinevirtual

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 294 of file DrawRangeElements.hpp.

◆ updateDirtyBufferObject()

template<class arr_type>
virtual void vl::DrawRangeElements< arr_type >::updateDirtyBufferObject ( EBufferObjectUpdateMode  )
inlinevirtual

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

Implements vl::DrawCall.

Definition at line 210 of file DrawRangeElements.hpp.

Member Data Documentation

◆ mCount

template<class arr_type>
i32 vl::DrawRangeElements< arr_type >::mCount
protected

◆ mIndexBuffer

template<class arr_type>
ref< arr_type > vl::DrawRangeElements< arr_type >::mIndexBuffer
protected

Definition at line 333 of file DrawRangeElements.hpp.

◆ mOffset

template<class arr_type>
u32 vl::DrawRangeElements< arr_type >::mOffset
protected

◆ primitive_restart_index

template<class arr_type>
const index_type vl::DrawRangeElements< 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 127 of file DrawRangeElements.hpp.


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