Visualization Library 2.0.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Wrapper for the OpenGL function glMultiDrawElements(). More...
#include <MultiDrawElements.hpp>
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... | |
MultiDrawElements (EPrimitiveType primitive=PT_TRIANGLES) | |
MultiDrawElements & | operator= (const MultiDrawElements &other) |
virtual ref< DrawCall > | clone () const |
Returns a clone of the draw call. More... | |
void | setIndexBuffer (arr_type *index_buffer) |
arr_type * | indexBuffer () |
const arr_type * | indexBuffer () const |
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... | |
const std::vector< const index_type * > & | pointerVector () const |
The pointer vector used as 'indices' parameter of glMultiDrawElements when NOT using BufferObjects. More... | |
std::vector< const index_type * > & | pointerVector () |
The pointer vector used as 'indices' parameter of glMultiDrawElements when NOT using BufferObjects. More... | |
const std::vector< const index_type * > & | bufferObjectPointerVector () const |
The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects. More... | |
std::vector< const index_type * > & | bufferObjectPointerVector () |
The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects. More... | |
void | computePointerVector () |
Computes pointerVector() based on the values contained on countVector(). More... | |
void | computeBufferObjectPointerVector () |
Computes bufferObjectPointerVector() based on the values contained in pointerVector(). More... | |
Public Member Functions inherited from vl::MultiDrawElementsBase | |
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 | finalizeSetup () |
Calls computePointerVector(), computeBufferObjectPointerVector() and resizes the base vertex array to fit the count vector. More... | |
void | setCountVector (const std::vector< GLsizei > &vcount) |
Sets the vector defining the length of each primitive and automatically computes the pointer vectors used to exectue glMultiDrawElements(). More... | |
void | setCountVector (const GLsizei *vcount, size_t size) |
Sets the vector defining the length of each primitive and automatically computes the pointer vectors used to exectue glMultiDrawElements(). More... | |
const std::vector< GLsizei > & | countVector () const |
The count vector used as 'count' parameter of glMultiDrawElements. More... | |
std::vector< GLsizei > & | countVector () |
The count vector used as 'count' parameter of glMultiDrawElements. More... | |
void | setBaseVertices (const std::vector< GLint > &base_verts) |
Returns the list of base vertices, one for each primitive. More... | |
const std::vector< GLint > & | baseVertices () const |
Returns the list of base vertices, one for each primitive. More... | |
std::vector< GLint > & | baseVertices () |
Returns the list of base vertices, one for each primitive. More... | |
Public Member Functions inherited from vl::DrawCall | |
DrawCall () | |
Constructor. More... | |
DrawCall & | operator= (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... | |
PatchParameter * | patchParameter () |
The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES. More... | |
const PatchParameter * | patchParameter () 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... | |
Object & | operator= (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... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () 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 |
std::vector< const index_type * > | mPointerVector |
std::vector< const index_type * > | mBufferObjectPointerVector |
Protected Attributes inherited from vl::MultiDrawElementsBase | |
bool | mPrimitiveRestartEnabled |
std::vector< GLsizei > | mCountVector |
std::vector< GLint > | mBaseVertices |
Protected Attributes inherited from vl::DrawCall | |
ref< PatchParameter > | mPatchParameter |
EPrimitiveType | mType |
bool | mEnabled |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
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 () |
Wrapper for the OpenGL function glMultiDrawElements().
See vl::DrawCall for an overview of the different draw call methods.
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 setBaseVertices() 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/glMultiDrawElementsBaseVertex.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.
Definition at line 151 of file MultiDrawElements.hpp.
typedef arr_type::scalar_type vl::MultiDrawElements< arr_type >::index_type |
Definition at line 156 of file MultiDrawElements.hpp.
|
inline |
Definition at line 162 of file MultiDrawElements.hpp.
|
inline |
The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects.
Definition at line 283 of file MultiDrawElements.hpp.
|
inline |
The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects.
Definition at line 286 of file MultiDrawElements.hpp.
|
inlinevirtual |
Returns a clone of the draw call.
Implements vl::DrawCall.
Definition at line 179 of file MultiDrawElements.hpp.
|
inlinevirtual |
Computes bufferObjectPointerVector() based on the values contained in pointerVector().
Implements vl::MultiDrawElementsBase.
Definition at line 302 of file MultiDrawElements.hpp.
|
inlinevirtual |
Computes pointerVector() based on the values contained on countVector().
Implements vl::MultiDrawElementsBase.
Definition at line 289 of file MultiDrawElements.hpp.
|
inlinevirtual |
Deletes the index buffer's BufferObject.
Implements vl::DrawCall.
Definition at line 198 of file MultiDrawElements.hpp.
|
inline |
Definition at line 188 of file MultiDrawElements.hpp.
Referenced by vlX::VLXClassWrapper_DrawCall::exportDrawCall(), vl::Geometry::mergeDrawCallsWithMultiDrawElements(), vl::MultiDrawElements< ArrayUShort1 >::operator=(), and vl::Geometry::shrinkDrawCalls().
|
inline |
Definition at line 190 of file MultiDrawElements.hpp.
|
inlinevirtual |
Returns a IndexIterator used to iterate through the virtual indices of a DrawCall.
This
Implements vl::DrawCall.
Definition at line 266 of file MultiDrawElements.hpp.
|
inline |
Definition at line 170 of file MultiDrawElements.hpp.
|
inline |
The pointer vector used as 'indices' parameter of glMultiDrawElements when NOT using BufferObjects.
Automatically computed when calling setCountVector(). If you need to modify this manually then you also have to modify the bufferObjectPointerVector.
Definition at line 277 of file MultiDrawElements.hpp.
|
inline |
The pointer vector used as 'indices' parameter of glMultiDrawElements when NOT using BufferObjects.
Definition at line 280 of file MultiDrawElements.hpp.
|
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 159 of file MultiDrawElements.hpp.
|
inlinevirtual |
Executes the draw call.
Implements vl::DrawCall.
Definition at line 203 of file MultiDrawElements.hpp.
|
inline |
Definition at line 186 of file MultiDrawElements.hpp.
Referenced by vl::DaeLoader::generateGeometry().
|
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 363 of file MultiDrawElements.hpp.
|
inlinevirtual |
Updates the index buffer's BufferObject if marked as dirty.
Implements vl::DrawCall.
Definition at line 192 of file MultiDrawElements.hpp.
|
protected |
Definition at line 318 of file MultiDrawElements.hpp.
|
protected |
Definition at line 316 of file MultiDrawElements.hpp.
|
protected |
Definition at line 317 of file MultiDrawElements.hpp.
|
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 158 of file MultiDrawElements.hpp.
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:10.
© Copyright Michele Bosi. All rights reserved.