#include <GLBuffer.h>
|
| | GLBuffer (GLenum target) |
| | Create a buffer object for the given OpenGL target.
|
| | ~GLBuffer () |
| | Destroy and delete the GL buffer name.
|
| void | setData (const std::vector< GLfloat > &data, size_t valuesPerElement, GLenum usage=GL_STATIC_DRAW) |
| | Upload interleaved float data and define element stride.
|
| void | setData (const std::vector< GLuint > &data) |
| | Upload unsigned-int data (e.g., element indices).
|
| void | setData (const float data[], size_t elemCount, size_t valuesPerElement, GLenum usage=GL_STATIC_DRAW) |
| | Upload interleaved float data from a raw pointer.
|
| void | setData (const GLuint data[], size_t elemCount) |
| | Upload unsigned-int data from a raw pointer.
|
| void | connectVertexAttrib (GLuint location, size_t elemCount, size_t offset=0, GLuint divisor=0) const |
| | Describe a vertex attribute array for the current buffer contents.
|
| void | bind () const |
| | Bind the buffer to its target with glBindBuffer(target, id).
|
◆ GLBuffer()
| GLBuffer::GLBuffer |
( |
GLenum | target | ) |
|
Create a buffer object for the given OpenGL target.
- Parameters
-
| target | Buffer binding target (e.g., GL_ARRAY_BUFFER). |
- Postcondition
- A GL name is generated via glGenBuffers.
◆ ~GLBuffer()
Destroy and delete the GL buffer name.
◆ bind()
| void GLBuffer::bind |
( |
| ) |
const |
Bind the buffer to its target with glBindBuffer(target, id).
◆ connectVertexAttrib()
| void GLBuffer::connectVertexAttrib |
( |
GLuint | location, |
|
|
size_t | elemCount, |
|
|
size_t | offset = 0, |
|
|
GLuint | divisor = 0 ) const |
Describe a vertex attribute array for the current buffer contents.
- Parameters
-
| location | Attribute location as retrieved from the shader. |
| elemCount | Number of components per attribute (e.g., 2,3,4). |
| offset | Offset (in elements, not bytes) from the beginning of each record. |
| divisor | Advanced: instance divisor for instanced rendering (0 = per-vertex). |
- Exceptions
-
| GLException | If no prior setData call has established an element type. |
Binds the buffer to its target, enables the attribute array, and calls glVertexAttribPointer with the stride and byte offset computed from the previously uploaded data.
◆ setData() [1/4]
| void GLBuffer::setData |
( |
const float | data[], |
|
|
size_t | elemCount, |
|
|
size_t | valuesPerElement, |
|
|
GLenum | usage = GL_STATIC_DRAW ) |
Upload interleaved float data from a raw pointer.
- Parameters
-
| data | Pointer to elemCount*valuesPerElement floats. |
| elemCount | Number of logical elements. |
| valuesPerElement | Number of floats per element (stride in values). |
| usage | GL usage hint. |
◆ setData() [2/4]
| void GLBuffer::setData |
( |
const GLuint | data[], |
|
|
size_t | elemCount ) |
Upload unsigned-int data from a raw pointer.
- Parameters
-
| data | Pointer to elemCount indices. |
| elemCount | Number of indices. |
◆ setData() [3/4]
| void GLBuffer::setData |
( |
const std::vector< GLfloat > & | data, |
|
|
size_t | valuesPerElement, |
|
|
GLenum | usage = GL_STATIC_DRAW ) |
Upload interleaved float data and define element stride.
- Parameters
-
| data | Flat vector of floats. |
| valuesPerElement | Number of float values that make up one logical element (stride in values). |
| usage | GL usage hint (e.g., GL_STATIC_DRAW). |
- Postcondition
- Internal bookkeeping (elemSize/stride/type) is updated for later attribute binding.
◆ setData() [4/4]
| void GLBuffer::setData |
( |
const std::vector< GLuint > & | data | ) |
|
Upload unsigned-int data (e.g., element indices).
- Parameters
-
| data | Flat vector of GLuint values. |
- Postcondition
- Element size/stride/type are set for index-style data (stride = 1, type = GL_UNSIGNED_INT).
The documentation for this class was generated from the following files: