Visualization Library 2.0.0-b3

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::DrawArrays Class Reference

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

#include <DrawArrays.hpp>

+ Inheritance diagram for vl::DrawArrays:

Public Member Functions

 DrawArrays ()
 
 DrawArrays (EPrimitiveType primitive, int start, int count, int instances=1)
 
DrawArraysoperator= (const DrawArrays &other)
 
virtual ref< DrawCallclone () const
 Returns a clone of the draw call. More...
 
virtual void deleteBufferObject ()
 Deletes the index buffer's BufferObject. More...
 
virtual void updateDirtyBufferObject (EBufferObjectUpdateMode)
 Updates the index buffer's BufferObject if marked as dirty. More...
 
virtual void render (bool) const
 Executes the draw call. More...
 
void setStart (int start)
 sets the starting vertex for the rendering. More...
 
int start () const
 returns the starting vertex for the rendering. More...
 
void setCount (int count)
 sets the number of vertices to be rendered. More...
 
int count () const
 returns the number of vertices to be rendered. More...
 
void setInstances (int instances)
 Sets the number of instances for this set of primitives. More...
 
int instances () const
 Returns the number of instances for this set of primitives. 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...
 
- Public Member Functions inherited from vl::DrawCall
 DrawCall ()
 Constructor. More...
 
DrawCalloperator= (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 bool primitiveRestartEnabled () const
 Returns whether the primitive-restart functionality is enabled or not. More...
 
virtual unsigned int primitiveRestartIndex ()
 Returns the primitive restart index used by the draw call or 0 if primitive restart is not supported. More...
 
void setPatchParameter (PatchParameter *patch_param)
 Attach a PatchParameter to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
PatchParameterpatchParameter ()
 The PatchParameter attached to a DrawCall to be used when using primitive-type PT_PATCHES. More...
 
const PatchParameterpatchParameter () 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...
 
Objectoperator= (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...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () 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...
 

Protected Attributes

int mStart
 
int mCount
 
int mInstances
 
- Protected Attributes inherited from vl::DrawCall
ref< PatchParametermPatchParameter
 
EPrimitiveType mType
 
bool mEnabled
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
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 ()
 

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:

Supports:

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

◆ DrawArrays() [1/2]

vl::DrawArrays::DrawArrays ( )
inline

Definition at line 62 of file DrawArrays.hpp.

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

Referenced by clone().

◆ DrawArrays() [2/2]

vl::DrawArrays::DrawArrays ( EPrimitiveType  primitive,
int  start,
int  count,
int  instances = 1 
)
inline

Definition at line 69 of file DrawArrays.hpp.

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

Member Function Documentation

◆ clone()

virtual ref<DrawCall> vl::DrawArrays::clone ( ) const
inlinevirtual

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().

◆ count()

int vl::DrawArrays::count ( ) const
inline

returns the number of vertices to be rendered.

Definition at line 129 of file DrawArrays.hpp.

References mCount.

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

◆ deleteBufferObject()

virtual void vl::DrawArrays::deleteBufferObject ( )
inlinevirtual

Deletes the index buffer's BufferObject.

Implements vl::DrawCall.

Definition at line 91 of file DrawArrays.hpp.

◆ indexIterator()

IndexIterator vl::DrawArrays::indexIterator ( ) const
inlinevirtual

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

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

◆ instances()

int vl::DrawArrays::instances ( ) const
inlinevirtual

Returns the number of instances for this set of primitives.

Reimplemented from vl::DrawCall.

Definition at line 135 of file DrawArrays.hpp.

References mInstances.

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

◆ operator=()

DrawArrays& vl::DrawArrays::operator= ( const DrawArrays other)
inline

Definition at line 77 of file DrawArrays.hpp.

References mCount, mInstances, and mStart.

◆ render()

virtual void vl::DrawArrays::render ( bool  use_bo) const
inlinevirtual

◆ setCount()

void vl::DrawArrays::setCount ( int  count)
inline

sets the number of vertices to be rendered.

Definition at line 126 of file DrawArrays.hpp.

References count(), and mCount.

◆ setInstances()

void vl::DrawArrays::setInstances ( int  instances)
inline

Sets the number of instances for this set of primitives.

Definition at line 132 of file DrawArrays.hpp.

References instances(), and mInstances.

◆ setStart()

void vl::DrawArrays::setStart ( int  start)
inline

sets the starting vertex for the rendering.

Definition at line 120 of file DrawArrays.hpp.

References mStart, and start().

◆ start()

int vl::DrawArrays::start ( ) const
inline

returns the starting vertex for the rendering.

Definition at line 123 of file DrawArrays.hpp.

References mStart.

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

◆ triangleIterator()

TriangleIterator vl::DrawArrays::triangleIterator ( ) const
inlinevirtual

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

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

◆ updateDirtyBufferObject()

virtual void vl::DrawArrays::updateDirtyBufferObject ( EBufferObjectUpdateMode  )
inlinevirtual

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

Implements vl::DrawCall.

Definition at line 92 of file DrawArrays.hpp.

Member Data Documentation

◆ mCount

int vl::DrawArrays::mCount
protected

Definition at line 155 of file DrawArrays.hpp.

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

◆ mInstances

int vl::DrawArrays::mInstances
protected

Definition at line 156 of file DrawArrays.hpp.

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

◆ mStart

int vl::DrawArrays::mStart
protected

Definition at line 154 of file DrawArrays.hpp.

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


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