Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes

vl::MultiDrawElements< arr_type > Class Template Reference

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

#include <MultiDrawElements.hpp>

Inheritance diagram for vl::MultiDrawElements< arr_type >:
vl::MultiDrawElementsBase vl::DrawCall vl::Object

List of all members.

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.
 MultiDrawElements (EPrimitiveType primitive=PT_TRIANGLES)
MultiDrawElementsoperator= (const MultiDrawElements &other)
virtual ref< DrawCallclone () const
 Returns a clone of the draw call.
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.
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.
LineIterator lineIterator () const
 Returns a LineIterator used to iterate through the lines of a DrawCall.
IndexIterator indexIterator () const
 Returns a IndexIterator used to iterate through the virtual indices of a DrawCall.
const std::vector< const
index_type * > & 
pointerVector () const
 The pointer vector used as 'indices' parameter of glMultiDrawElements when NOT using BufferObjects.
std::vector< const index_type * > & pointerVector ()
 The pointer vector used as 'indices' parameter of glMultiDrawElements when NOT using BufferObjects.
const std::vector< const
index_type * > & 
bufferObjectPointerVector () const
 The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects.
std::vector< const index_type * > & bufferObjectPointerVector ()
 The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects.
void computePointerVector ()
 Computes pointerVector() based on the values contained on countVector().
void computeBufferObjectPointerVector ()
 Computes bufferObjectPointerVector() based on the values contained in pointerVector().

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
std::vector< const index_type * > mPointerVector
std::vector< const index_type * > mBufferObjectPointerVector

Detailed Description

template<class arr_type>
class vl::MultiDrawElements< arr_type >

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.

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

Definition at line 152 of file MultiDrawElements.hpp.


Member Typedef Documentation

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

Definition at line 157 of file MultiDrawElements.hpp.


Constructor & Destructor Documentation

template<class arr_type>
vl::MultiDrawElements< arr_type >::MultiDrawElements ( EPrimitiveType  primitive = PT_TRIANGLES) [inline]

Definition at line 163 of file MultiDrawElements.hpp.

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


Member Function Documentation

template<class arr_type>
virtual unsigned int vl::MultiDrawElements< 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 160 of file MultiDrawElements.hpp.

template<class arr_type>
MultiDrawElements& vl::MultiDrawElements< arr_type >::operator= ( const MultiDrawElements< arr_type > &  other) [inline]
template<class arr_type>
virtual ref<DrawCall> vl::MultiDrawElements< arr_type >::clone ( ) const [inline, virtual]

Returns a clone of the draw call.

Implements vl::DrawCall.

Definition at line 180 of file MultiDrawElements.hpp.

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

Definition at line 187 of file MultiDrawElements.hpp.

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

Definition at line 191 of file MultiDrawElements.hpp.

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

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

Implements vl::DrawCall.

Definition at line 193 of file MultiDrawElements.hpp.

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

Deletes the index buffer's BufferObject.

Implements vl::DrawCall.

Definition at line 199 of file MultiDrawElements.hpp.

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

Executes the draw call.

Implements vl::DrawCall.

Definition at line 204 of file MultiDrawElements.hpp.

template<class arr_type >
TriangleIterator vl::MultiDrawElements< arr_type >::triangleIterator ( ) const [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 366 of file MultiDrawElements.hpp.

References vl::ref< T >::get().

template<class arr_type >
LineIterator vl::MultiDrawElements< arr_type >::lineIterator ( ) const [virtual]

Returns a LineIterator used to iterate through the lines of a DrawCall.

Implements vl::DrawCall.

Definition at line 376 of file MultiDrawElements.hpp.

References vl::ref< T >::get().

template<class arr_type>
IndexIterator vl::MultiDrawElements< 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 269 of file MultiDrawElements.hpp.

template<class arr_type>
const std::vector<const index_type*>& vl::MultiDrawElements< arr_type >::pointerVector ( ) const [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 280 of file MultiDrawElements.hpp.

Referenced by vl::MultiDrawElements< ArrayUShort1 >::render().

template<class arr_type>
std::vector<const index_type*>& vl::MultiDrawElements< arr_type >::pointerVector ( ) [inline]

The pointer vector used as 'indices' parameter of glMultiDrawElements when NOT using BufferObjects.

Definition at line 283 of file MultiDrawElements.hpp.

template<class arr_type>
const std::vector<const index_type*>& vl::MultiDrawElements< arr_type >::bufferObjectPointerVector ( ) const [inline]

The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects.

Definition at line 286 of file MultiDrawElements.hpp.

template<class arr_type>
std::vector<const index_type*>& vl::MultiDrawElements< arr_type >::bufferObjectPointerVector ( ) [inline]

The pointer vector used as 'indices' parameter of glMultiDrawElements when using BufferObjects.

Definition at line 289 of file MultiDrawElements.hpp.

template<class arr_type>
void vl::MultiDrawElements< arr_type >::computePointerVector ( ) [inline, virtual]

Computes pointerVector() based on the values contained on countVector().

Implements vl::MultiDrawElementsBase.

Definition at line 292 of file MultiDrawElements.hpp.

template<class arr_type>
void vl::MultiDrawElements< arr_type >::computeBufferObjectPointerVector ( ) [inline, virtual]

Computes bufferObjectPointerVector() based on the values contained in pointerVector().

Implements vl::MultiDrawElementsBase.

Definition at line 305 of file MultiDrawElements.hpp.


Member Data Documentation

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

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

template<class arr_type>
ref< arr_type > vl::MultiDrawElements< arr_type >::mIndexBuffer [protected]
template<class arr_type>
std::vector<const index_type*> vl::MultiDrawElements< arr_type >::mPointerVector [protected]
template<class arr_type>
std::vector<const index_type*> vl::MultiDrawElements< arr_type >::mBufferObjectPointerVector [protected]

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

Visualization Library 2011.09.1160 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 2 2013 13:41:30.
Permission is granted to use this page to write and publish articles regarding Visualization Library.