CGVIS Utils
Loading...
Searching...
No Matches
GLArray Class Reference

#include <GLArray.h>

Public Member Functions

 GLArray ()
 Generate a VAO and bind it.
 ~GLArray ()
 Destroy and delete the VAO name.
void bind () const
 Bind this VAO for subsequent vertex specification/draws.
void connectVertexAttrib (const GLBuffer &buffer, const GLProgram &program, const std::string &variable, size_t elemCount, size_t offset=0, GLuint divisor=0) const
 Connect a vertex attribute from a buffer to a program input.
void connectIndexBuffer (const GLBuffer &buffer) const
 Bind buffer as the index (element) buffer for this VAO.

Constructor & Destructor Documentation

◆ GLArray()

GLArray::GLArray ( )

Generate a VAO and bind it.

◆ ~GLArray()

GLArray::~GLArray ( )

Destroy and delete the VAO name.

Member Function Documentation

◆ bind()

void GLArray::bind ( ) const

Bind this VAO for subsequent vertex specification/draws.

Here is the caller graph for this function:

◆ connectIndexBuffer()

void GLArray::connectIndexBuffer ( const GLBuffer & buffer) const

Bind buffer as the index (element) buffer for this VAO.

Parameters
bufferBuffer previously filled with indices (GLuint).
Here is the call graph for this function:

◆ connectVertexAttrib()

void GLArray::connectVertexAttrib ( const GLBuffer & buffer,
const GLProgram & program,
const std::string & variable,
size_t elemCount,
size_t offset = 0,
GLuint divisor = 0 ) const

Connect a vertex attribute from a buffer to a program input.

Parameters
bufferSource buffer holding interleaved attribute data.
programShader program from which to query the attribute location.
variableAttribute identifier in the shader (e.g., "in_position").
elemCountComponents per vertex attribute (e.g., 2, 3, or 4).
offsetOffset (in elements, not bytes) from the start of each record.
divisorInstance divisor (0 = per-vertex; >0 = per-instance).

Queries the attribute location from program and forwards the binding to GLBuffer::connectVertexAttrib() using the stride/element size derived from the most recent setData() on buffer.

Here is the call graph for this function:

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