Unofficial OpenGL Software Development Kit  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
List of all members | Public Member Functions
glmesh::RenderCmdList Class Reference

#include <Mesh.h>

A list of rendering commands to be used by a Mesh.

This class is part of the setup process for creating a Mesh. It stores a series of OpenGL rendering commands which will be used when rendering a particular Mesh. The series of commands will be used in the order given.

Indexed rendering commands (glDrawElements and its ilk) will use the element buffer that is stored in the VAO used by the Mesh to render. You do not provide the element buffer to these functions.

The rendering command functions mimic their OpenGL counterparts where possible.

Public Member Functions

 RenderCmdList ()
 Creates an empty RenderCmdList.
 
 ~RenderCmdList ()
 Destroys the object.
 
void DrawArrays (GLenum primitive, GLint startIndex, GLsizei vertexCount)
 Adds a glDrawArrays command to the list of rendering commands. More...
 
void DrawElements (GLenum primitive, GLsizei vertexCount, GLenum dataType, GLintptr byteOffset, GLint baseVertex=0)
 Adds a glDrawElements-style command to the list of rendering commands. More...
 
void PrimitiveRestartIndex ()
 Subsequent indexed rendering functions will not use a primitive restart index.
 
void PrimitiveRestartIndex (GLuint index)
 Subsequent indexed rendering functions will use the given index as the primitive restart index. More...
 

Member Function Documentation

void glmesh::RenderCmdList::DrawArrays ( GLenum  primitive,
GLint  startIndex,
GLsizei  vertexCount 
)

Adds a glDrawArrays command to the list of rendering commands.

Parameters
primitiveThe OpenGL primitive type to render.
startIndexThe first index in the vertex arrays to render.
vertexCountThe number of vertices to render.
void glmesh::RenderCmdList::DrawElements ( GLenum  primitive,
GLsizei  vertexCount,
GLenum  dataType,
GLintptr  byteOffset,
GLint  baseVertex = 0 
)

Adds a glDrawElements-style command to the list of rendering commands.

If there is a currently set restart index (with PrimitiveRestartIndex(GLuint) ), then it will be rendered with that as the restart index.

Parameters
primitiveThe OpenGL primitive type to render.
vertexCountThe number of vertices to render.
dataTypeThe OpenGL data type of the indices (GL_UNSIGNED_SHORT, etc).
byteOffsetThe offset from the beginning of the index buffer to where OpenGL will begin to pull data.
baseVertexAn integer offset to be added to each index before fetching from the buffer. The restart index check happens before adding baseVertex to the index.
Note
If you specify a non-zero baseVertex, then rendering with this command list will require OpenGL 3.2 or ARB_draw_elements_base_vertex. No exception will be thrown for lacking these features; the attempt to execute the rendering command will simply crash.
void glmesh::RenderCmdList::PrimitiveRestartIndex ( GLuint  index)

Subsequent indexed rendering functions will use the given index as the primitive restart index.

The primitive restart index will affect all indexed rendering functions (like glDrawElements) until it is changed with a later call to this function. To stop using the restart index, use PrimitiveRestartIndex().

Note
If you specify a primitive restart index, then rendering with this command list will require OpenGL 3.0. No exception will be thrown for lacking this version; the attempt to execute the rendering command will simply crash.

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