# Visualization Library

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

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

Public Member Functions | Protected Attributes

# vl::DrawArrays Class Reference

Wraps the OpenGL function glDrawArrays(). More...

`#include <DrawArrays.hpp>`

Inheritance diagram for vl::DrawArrays:

List of all members.

## Public Member Functions

| DrawArrays ()
| DrawArrays (EPrimitiveType primitive, int start, int count, int instances=1)
DrawArrays & | operator= (const DrawArrays &other)
virtual ref< DrawCall > | clone () const
| Returns a clone of the draw call.
virtual void | deleteBufferObject ()
| Deletes the index buffer's BufferObject.
virtual void | updateDirtyBufferObject (EBufferObjectUpdateMode)
| Updates the index buffer's BufferObject if marked as dirty.
virtual void | render (bool) const
| Executes the draw call.
void | setStart (int start)
| sets the starting vertex for the rendering.
int | start () const
| returns the starting vertex for the rendering.
void | setCount (int count)
| sets the number of vertices to be rendered.
int | count () const
| returns the number of vertices to be rendered.
void | setInstances (int instances)
| Sets the number of instances for this set of primitives.
int | instances () const
| Returns the number of instances for this set of primitives.
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.

## Protected Attributes

int | mStart
int | mCount
int | mInstances

## Detailed Description

Wraps the OpenGL function glDrawArrays().

See vl::DrawCall for an overview of the different draw call methods.

This class wraps the following OpenGL functions:

- 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

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 57 of file DrawArrays.hpp.

## Constructor & Destructor Documentation

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

Definition at line 62 of file DrawArrays.hpp.

References mInstances, vl::DrawCall::mType, vl::PT_TRIANGLES, and VL_DEBUG_SET_OBJECT_NAME.

Referenced by clone().

vl::DrawArrays::DrawArrays | ( | EPrimitiveType | primitive,
|  | int | start,
|  | int | count,
|  | int | instances = `1`
| ) |  | `[inline]`

Definition at line 69 of file DrawArrays.hpp.

References instances(), mInstances, vl::DrawCall::mType, and VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

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

Definition at line 77 of file DrawArrays.hpp.

References mCount, mInstances, and mStart.

virtual ref<DrawCall> vl::DrawArrays::clone | ( | ) | const`[inline, virtual]`

Returns a clone of the draw call.

Implements vl::DrawCall.

Definition at line 86 of file DrawArrays.hpp.

References count(), DrawArrays(), instances(), vl::DrawCall::primitiveType(), and start().

virtual void vl::DrawArrays::deleteBufferObject | ( | ) | `[inline, virtual]`

Deletes the index buffer's BufferObject.

Implements vl::DrawCall.

Definition at line 91 of file DrawArrays.hpp.

virtual void vl::DrawArrays::updateDirtyBufferObject | ( | EBufferObjectUpdateMode | ) | `[inline, virtual]`

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

Implements vl::DrawCall.

Definition at line 92 of file DrawArrays.hpp.

virtual void vl::DrawArrays::render | ( | bool | use_bo ) | const`[inline, virtual]`

Executes the draw call.

Implements vl::DrawCall.

Definition at line 94 of file DrawArrays.hpp.

References vl::DrawCall::applyPatchParameters(), count(), vl::Log::error(), vl::getGLErrorString(), instances(), vl::DrawCall::primitiveType(), start(), VL_TRAP, and vl::Log::warning().

void vl::DrawArrays::setStart | ( | int | start ) | `[inline]`

sets the starting vertex for the rendering.

Definition at line 118 of file DrawArrays.hpp.

References mStart, and start().

int vl::DrawArrays::start | ( | ) | const`[inline]`

returns the starting vertex for the rendering.

Definition at line 121 of file DrawArrays.hpp.

References mStart.

Referenced by clone(), vl::VLXClassWrapper_DrawCall::exportDrawCall(), render(), and setStart().

void vl::DrawArrays::setCount | ( | int | count ) | `[inline]`

sets the number of vertices to be rendered.

Definition at line 124 of file DrawArrays.hpp.

References count(), and mCount.

int vl::DrawArrays::count | ( | ) | const`[inline]`

returns the number of vertices to be rendered.

Definition at line 127 of file DrawArrays.hpp.

References mCount.

Referenced by clone(), vl::VLXClassWrapper_DrawCall::exportDrawCall(), render(), and setCount().

void vl::DrawArrays::setInstances | ( | int | instances ) | `[inline]`

Sets the number of instances for this set of primitives.

Definition at line 130 of file DrawArrays.hpp.

References instances(), and mInstances.

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

Returns the number of instances for this set of primitives.

Reimplemented from vl::DrawCall.

Definition at line 133 of file DrawArrays.hpp.

References mInstances.

Referenced by clone(), DrawArrays(), vl::VLXClassWrapper_DrawCall::exportDrawCall(), render(), and setInstances().

TriangleIterator vl::DrawArrays::triangleIterator | ( | ) | const`[inline, 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 135 of file DrawArrays.hpp.

References vl::ref< T >::get(), mCount, mStart, and vl::DrawCall::primitiveType().

IndexIterator vl::DrawArrays::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 142 of file DrawArrays.hpp.

References vl::ref< T >::get(), vl::IndexIterator::initialize(), mCount, and mStart.

## Member Data Documentation

int vl::DrawArrays::mStart`[protected]`

Definition at line 152 of file DrawArrays.hpp.

Referenced by indexIterator(), operator=(), setStart(), start(), and triangleIterator().

int vl::DrawArrays::mCount`[protected]`

Definition at line 153 of file DrawArrays.hpp.

Referenced by count(), indexIterator(), operator=(), setCount(), and triangleIterator().

int vl::DrawArrays::mInstances`[protected]`

Definition at line 154 of file DrawArrays.hpp.

Referenced by DrawArrays(), instances(), operator=(), and setInstances().

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

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

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