# Visualization Library

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

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Member Functions | Protected Attributes

# vl::DrawCall Class Reference

The base class of DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements. More...

`#include <DrawCall.hpp>`

Inheritance diagram for vl::DrawCall:

List of all members.

## Public Member Functions

| DrawCall ()
| Constructor.
DrawCall & | operator= (const DrawCall &other)
| Assignment operator.
void | setPrimitiveType (EPrimitiveType type)
| Sets the draw call's primitive type.
EPrimitiveType | primitiveType () const
| Returns the draw call's primitive type.
virtual void | render (bool use_bo=true) const =0
| Executes the draw call.
virtual ref< DrawCall > | clone () const =0
| Returns a clone of the draw call.
virtual void | updateDirtyBufferObject (EBufferObjectUpdateMode)=0
| Updates the index buffer's BufferObject if marked as dirty.
virtual void | deleteBufferObject ()=0
| Deletes the index buffer's BufferObject.
void | setEnabled (bool enable)
| Enables/disables the draw call.
bool | isEnabled () const
| True if the draw call is enabled.
virtual TriangleIterator | triangleIterator () const =0
| Returns a TriangleIterator used to iterate through the triangles of a DrawCall.
virtual IndexIterator | indexIterator () const =0
| Returns a IndexIterator used to iterate through the virtual indices of a DrawCall.
u32 | countIndices () const
| Counts the number of virtual indices of a DrawCall., i.e.
u32 | countTriangles () const
| Counts the number of virtual triangles of a DrawCall., i.e.
virtual int | instances () const
| Returns the number of instances for this set of primitives.
virtual bool | primitiveRestartEnabled () const
| Returns whether the primitive-restart functionality is enabled or not.
virtual unsigned int | primitiveRestartIndex ()
| Returns the primitive restart index used by the draw call or 0 if primitive restart is not supported.
void | setPatchParameter (PatchParameter *patch_param)
| Attach a PatchParameter to a DrawCall to be used when using primitive-type PT_PATCHES.
PatchParameter * | patchParameter ()
| The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES.
const PatchParameter * | patchParameter () const
| The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES.

## Protected Member Functions

void | applyPatchParameters () const

## Protected Attributes

ref< PatchParameter > | mPatchParameter
EPrimitiveType | mType
bool | mEnabled

## Detailed Description

The base class of DrawArrays, DrawElements, MultiDrawElements and DrawRangeElements.

which are used by Geometry to define a set of primitives to be rendered (see also Geometry::drawCalls()).

Overview

vl::DrawArrays wraps:

- glDrawArrays (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawArrays.xml)
- glDrawArraysInstanced (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawArraysInstanced.xml)

Supports:

- Multi instancing: YES
- Base vertex: N/A
- Primitive restart: N/A

vl::DrawElements wraps:

- glDrawElements (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawElements.xml)
- glDrawElementsInstanced (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawElementsInstanced.xml)
- glDrawElementsBaseVertex (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawElementsBaseVertex.xml)
- glDrawElementsInstancedBaseVertex (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawElementsInstancedBaseVertex.xml)

Supports:

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

vl::DrawRangeElements wraps:

- glDrawRangeElements (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawRangeElements.xml)
- glDrawRangeElementsBaseVertex (http://www.opengl.org/sdk/docs/man4/xhtml/glDrawRangeElementsBaseVertex.xml)

Supports:

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

vl::MultiDrawElements wraps:

- 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

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 90 of file DrawCall.hpp.

## Constructor & Destructor Documentation

vl::DrawCall::DrawCall | ( | ) | `[inline]`

Constructor.

Definition at line 96 of file DrawCall.hpp.

## Member Function Documentation

DrawCall& vl::DrawCall::operator= | ( | const DrawCall & | other ) | `[inline]`

Assignment operator.

Definition at line 99 of file DrawCall.hpp.

References mEnabled, and mType.

void vl::DrawCall::setPrimitiveType | ( | EPrimitiveType | type ) | `[inline]`

Sets the draw call's primitive type.

Definition at line 107 of file DrawCall.hpp.

References mType.

Referenced by vl::VLXClassWrapper_DrawCall::importDrawCall().

EPrimitiveType vl::DrawCall::primitiveType | ( | ) | const`[inline]`

Returns the draw call's primitive type.

Definition at line 110 of file DrawCall.hpp.

References mType.

Referenced by vl::DrawArrays::clone(), vl::VLXClassWrapper_DrawCall::exportDrawCallBase(), vl::Geometry::fixTriangleWinding(), vl::VLXClassWrapper_DrawCall::importDrawCall(), vl::Geometry::makeGLESFriendly(), vl::Geometry::mergeDrawCallsWithTriangles(), vl::MultiDrawElements< ArrayUShort1 >::render(), vl::DrawRangeElements< ArrayUShort1 >::render(), vl::DrawElements< ArrayUShort1 >::render(), vl::DrawArrays::render(), vl::Geometry::sortVertices(), vl::DrawRangeElements< ArrayUShort1 >::triangleIterator(), vl::DrawElements< ArrayUShort1 >::triangleIterator(), vl::DrawArrays::triangleIterator(), and vl::Geometry::triangulateDrawCalls().

virtual void vl::DrawCall::render | ( | bool | use_bo = `true` ) | const`[pure virtual]`

Executes the draw call.

Implemented in vl::DrawArrays, vl::DrawElements< arr_type >, vl::DrawRangeElements< arr_type >, vl::MultiDrawElements< arr_type >, vl::DrawElements< ArrayUInt1 >, vl::DrawElements< ArrayUByte1 >, vl::DrawElements< ArrayUShort1 >, vl::DrawRangeElements< ArrayUInt1 >, vl::DrawRangeElements< ArrayUByte1 >, vl::DrawRangeElements< ArrayUShort1 >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Referenced by vl::Geometry::render_Implementation().

virtual ref<DrawCall> vl::DrawCall::clone | ( | ) | const`[pure virtual]`

Returns a clone of the draw call.

Implemented in vl::DrawArrays, vl::DrawElements< arr_type >, vl::DrawRangeElements< arr_type >, vl::MultiDrawElements< arr_type >, vl::DrawElements< ArrayUInt1 >, vl::DrawElements< ArrayUByte1 >, vl::DrawElements< ArrayUShort1 >, vl::DrawRangeElements< ArrayUInt1 >, vl::DrawRangeElements< ArrayUByte1 >, vl::DrawRangeElements< ArrayUShort1 >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

virtual void vl::DrawCall::updateDirtyBufferObject | ( | EBufferObjectUpdateMode | ) | `[pure virtual]`

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

Implemented in vl::DrawArrays, vl::DrawElements< arr_type >, vl::DrawRangeElements< arr_type >, vl::MultiDrawElements< arr_type >, vl::DrawElements< ArrayUInt1 >, vl::DrawElements< ArrayUByte1 >, vl::DrawElements< ArrayUShort1 >, vl::DrawRangeElements< ArrayUInt1 >, vl::DrawRangeElements< ArrayUByte1 >, vl::DrawRangeElements< ArrayUShort1 >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Referenced by vl::Geometry::updateDirtyBufferObject().

virtual void vl::DrawCall::deleteBufferObject | ( | ) | `[pure virtual]`

Deletes the index buffer's BufferObject.

Implemented in vl::DrawArrays, vl::DrawElements< arr_type >, vl::DrawRangeElements< arr_type >, vl::MultiDrawElements< arr_type >, vl::DrawElements< ArrayUInt1 >, vl::DrawElements< ArrayUByte1 >, vl::DrawElements< ArrayUShort1 >, vl::DrawRangeElements< ArrayUInt1 >, vl::DrawRangeElements< ArrayUByte1 >, vl::DrawRangeElements< ArrayUShort1 >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Referenced by vl::Geometry::deleteBufferObject().

void vl::DrawCall::setEnabled | ( | bool | enable ) | `[inline]`

Enables/disables the draw call.

Definition at line 125 of file DrawCall.hpp.

References mEnabled.

Referenced by vl::VLXClassWrapper_DrawCall::importDrawCall(), and vl::Geometry::makeGLESFriendly().

bool vl::DrawCall::isEnabled | ( | ) | const`[inline]`

True if the draw call is enabled.

Definition at line 128 of file DrawCall.hpp.

References mEnabled.

Referenced by vl::VLXClassWrapper_DrawCall::exportDrawCallBase(), and vl::Geometry::render_Implementation().

virtual TriangleIterator vl::DrawCall::triangleIterator | ( | ) | const`[pure 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.

Implemented in vl::DrawArrays, vl::DrawElements< arr_type >, vl::DrawRangeElements< arr_type >, vl::MultiDrawElements< arr_type >, vl::DrawElements< ArrayUInt1 >, vl::DrawElements< ArrayUByte1 >, vl::DrawElements< ArrayUShort1 >, vl::DrawRangeElements< ArrayUInt1 >, vl::DrawRangeElements< ArrayUByte1 >, vl::DrawRangeElements< ArrayUShort1 >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Referenced by vl::Geometry::computeTangentSpace(), countTriangles(), vl::EdgeExtractor::extractEdges(), vl::RayIntersector::intersectGeometry(), vl::PolygonSimplifier::simplify(), and vl::Geometry::triangulateDrawCalls().

virtual IndexIterator vl::DrawCall::indexIterator | ( | ) | const`[pure 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.

Implemented in vl::DrawArrays, vl::DrawElements< arr_type >, vl::DrawRangeElements< arr_type >, vl::MultiDrawElements< arr_type >, vl::DrawElements< ArrayUInt1 >, vl::DrawElements< ArrayUByte1 >, vl::DrawElements< ArrayUShort1 >, vl::DrawRangeElements< ArrayUInt1 >, vl::DrawRangeElements< ArrayUByte1 >, vl::DrawRangeElements< ArrayUShort1 >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Referenced by vl::Geometry::computeBounds_Implementation(), and countIndices().

u32 vl::DrawCall::countIndices | ( | ) | const`[inline]`

Counts the number of virtual indices of a DrawCall., i.e.

the number of indices you would retrieve by iterating over the iterator returned by indexIterator().

Definition at line 142 of file DrawCall.hpp.

References vl::IndexIterator::hasNext(), and indexIterator().

Referenced by vl::Geometry::mergeDrawCallsWithMultiDrawElements(), and vl::Geometry::mergeDrawCallsWithPrimitiveRestart().

u32 vl::DrawCall::countTriangles | ( | ) | const`[inline]`

Counts the number of virtual triangles of a DrawCall., i.e.

the number of triangles you would retrieve by iterating over the iterator returned by triangleIterator().

Definition at line 151 of file DrawCall.hpp.

References vl::TriangleIterator::hasNext(), and triangleIterator().

Referenced by vl::Geometry::fixTriangleWinding(), vl::Geometry::mergeDrawCallsWithTriangles(), and vl::Geometry::triangulateDrawCalls().

virtual int vl::DrawCall::instances | ( | ) | const`[inline, virtual]`

Returns the number of instances for this set of primitives.

Reimplemented in vl::DrawArrays, and vl::DrawElementsBase.

Definition at line 160 of file DrawCall.hpp.

Referenced by vl::Geometry::triangulateDrawCalls().

virtual bool vl::DrawCall::primitiveRestartEnabled | ( | ) | const`[inline, virtual]`

Returns whether the primitive-restart functionality is enabled or not.

See http://www.opengl.org/registry/specs/NV/primitive_restart.txt

Reimplemented in vl::DrawElementsBase, vl::DrawRangeElementsBase, and vl::MultiDrawElementsBase.

Definition at line 163 of file DrawCall.hpp.

Referenced by vl::Geometry::sortVertices().

virtual unsigned int vl::DrawCall::primitiveRestartIndex | ( | ) | `[inline, virtual]`

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

Reimplemented in vl::DrawElements< arr_type >, vl::DrawRangeElements< arr_type >, vl::MultiDrawElements< arr_type >, vl::DrawElements< ArrayUInt1 >, vl::DrawElements< ArrayUByte1 >, vl::DrawElements< ArrayUShort1 >, vl::DrawRangeElements< ArrayUInt1 >, vl::DrawRangeElements< ArrayUByte1 >, vl::DrawRangeElements< ArrayUShort1 >, vl::MultiDrawElements< ArrayUInt1 >, vl::MultiDrawElements< ArrayUByte1 >, and vl::MultiDrawElements< ArrayUShort1 >.

Definition at line 166 of file DrawCall.hpp.

void vl::DrawCall::setPatchParameter | ( | PatchParameter * | patch_param ) | `[inline]`

Attach a PatchParameter to a DrawCall to be used when using primitive-type PT_PATCHES.

Definition at line 169 of file DrawCall.hpp.

References mPatchParameter.

PatchParameter* vl::DrawCall::patchParameter | ( | ) | `[inline]`

The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES.

Definition at line 172 of file DrawCall.hpp.

References vl::ref< T >::get(), and mPatchParameter.

Referenced by vl::VLXClassWrapper_DrawCall::exportDrawCallBase().

const PatchParameter* vl::DrawCall::patchParameter | ( | ) | const`[inline]`

The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES.

Definition at line 175 of file DrawCall.hpp.

References vl::ref< T >::get(), and mPatchParameter.

void vl::DrawCall::applyPatchParameters | ( | ) | const`[inline, protected]`

Definition at line 178 of file DrawCall.hpp.

References mPatchParameter, mType, vl::PT_PATCHES, and vl::Log::warning().

Referenced by vl::MultiDrawElements< ArrayUShort1 >::render(), vl::DrawRangeElements< ArrayUShort1 >::render(), vl::DrawElements< ArrayUShort1 >::render(), and vl::DrawArrays::render().

## Member Data Documentation

ref<PatchParameter> vl::DrawCall::mPatchParameter`[protected]`

Definition at line 195 of file DrawCall.hpp.

Referenced by applyPatchParameters(), patchParameter(), and setPatchParameter().

EPrimitiveType vl::DrawCall::mType`[protected]`

Definition at line 196 of file DrawCall.hpp.

Referenced by applyPatchParameters(), vl::DrawArrays::DrawArrays(), vl::DrawElements< ArrayUShort1 >::DrawElements(), vl::DrawRangeElements< ArrayUShort1 >::DrawRangeElements(), vl::MultiDrawElements< ArrayUShort1 >::MultiDrawElements(), operator=(), primitiveType(), and setPrimitiveType().

bool vl::DrawCall::mEnabled`[protected]`

Definition at line 197 of file DrawCall.hpp.

Referenced by isEnabled(), operator=(), and setEnabled().

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

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

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