# 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 >:

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)
MultiDrawElements & | operator= (const MultiDrawElements &other)
virtual ref< DrawCall > | clone () 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.
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:

- glMultiDrawElements (http://www.opengl.org/sdk/docs/man4/xhtml/glMultiDrawElements.xml)
- glMultiDrawElementsBaseVertex (http://www.opengl.org/sdk/docs/man4/xhtml/glMultiDrawElementsBaseVertex.xml)

Supports:

- Multi instancing: NO
- Base vertex: YES
- Primitive restart: YES

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 151 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 156 of file MultiDrawElements.hpp.

## Constructor & Destructor Documentation

template<class arr_type>

vl::MultiDrawElements< arr_type >::MultiDrawElements | ( | EPrimitiveType | primitive = `PT_TRIANGLES` ) | `[inline]`

Definition at line 162 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 159 of file MultiDrawElements.hpp.

template<class arr_type>

MultiDrawElements& vl::MultiDrawElements< arr_type >::operator= | ( | const MultiDrawElements< arr_type > & | other ) | `[inline]`

Definition at line 170 of file MultiDrawElements.hpp.

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

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 179 of file MultiDrawElements.hpp.

template<class arr_type>

void vl::MultiDrawElements< arr_type >::setIndexBuffer | ( | arr_type * | index_buffer ) | `[inline]`

Definition at line 186 of file MultiDrawElements.hpp.

template<class arr_type>

arr_type* vl::MultiDrawElements< arr_type >::indexBuffer | ( | ) | `[inline]`

Definition at line 188 of file MultiDrawElements.hpp.

Referenced by vl::MultiDrawElements< ArrayUShort1 >::computeBufferObjectPointerVector(), vl::MultiDrawElements< ArrayUShort1 >::computePointerVector(), vl::MultiDrawElements< ArrayUShort1 >::deleteBufferObject(), vl::VLXClassWrapper_DrawCall::exportDrawCall(), vl::MultiDrawElements< ArrayUShort1 >::operator=(), vl::MultiDrawElements< ArrayUShort1 >::render(), and vl::MultiDrawElements< ArrayUShort1 >::updateDirtyBufferObject().

template<class arr_type>

const arr_type* vl::MultiDrawElements< arr_type >::indexBuffer | ( | ) | const`[inline]`

Definition at line 190 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 192 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 198 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 203 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 363 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 266 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 277 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 280 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 283 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 286 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 289 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 302 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 158 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]`

Definition at line 316 of file MultiDrawElements.hpp.

Referenced by vl::MultiDrawElements< ArrayUShort1 >::indexBuffer(), vl::MultiDrawElements< ArrayUShort1 >::indexIterator(), vl::MultiDrawElements< ArrayUShort1 >::MultiDrawElements(), and vl::MultiDrawElements< ArrayUShort1 >::setIndexBuffer().

template<class arr_type>

std::vector<const index_type*> vl::MultiDrawElements< arr_type >::mPointerVector`[protected]`

Definition at line 317 of file MultiDrawElements.hpp.

Referenced by vl::MultiDrawElements< ArrayUShort1 >::computeBufferObjectPointerVector(), vl::MultiDrawElements< ArrayUShort1 >::computePointerVector(), vl::MultiDrawElements< ArrayUShort1 >::pointerVector(), and vl::MultiDrawElements< ArrayUShort1 >::render().

template<class arr_type>

std::vector<const index_type*> vl::MultiDrawElements< arr_type >::mBufferObjectPointerVector`[protected]`

Definition at line 318 of file MultiDrawElements.hpp.

Referenced by vl::MultiDrawElements< ArrayUShort1 >::bufferObjectPointerVector(), vl::MultiDrawElements< ArrayUShort1 >::computeBufferObjectPointerVector(), and vl::MultiDrawElements< ArrayUShort1 >::render().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/MultiDrawElements.hpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:40.
Permission is granted to use this page to write and publish articles regarding Visualization Library.