|
lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
|
Manages a vertex buffer in OpenGL. More...
#include <buffer.hpp>
Public Member Functions | |
| VertexBuffer (const void *vertices, unsigned int size, bool dynamic=false) | |
| Constructor for the VertexBuffer. | |
| ~VertexBuffer () | |
| Destructor for the VertexBuffer. | |
| void | bind () const |
| Bind the vertex buffer. | |
| void | unbind () const |
| Unbind the vertex buffer. | |
| void | set_data (const void *data, unsigned int size) |
| Set the data of the vertex buffer. | |
| void | set_layout (const BufferLayout &layout) |
| Set the layout of the vertex buffer. | |
| const BufferLayout & | get_layout () const |
| Get the layout of the vertex buffer. | |
Manages a vertex buffer in OpenGL.
This class encapsulates the creation, binding, and management of a vertex buffer. It allows for dynamic or static data storage and provides methods to set data and retrieve the buffer layout.
| lmgl::renderer::VertexBuffer::VertexBuffer | ( | const void * | vertices, |
| unsigned int | size, | ||
| bool | dynamic = false ) |
Constructor for the VertexBuffer.
Initializes the vertex buffer with the provided vertex data and size. The buffer can be created as dynamic or static based on the 'dynamic' flag.
| vertices | Pointer to the vertex data. |
| size | Size of the vertex data in bytes. |
| dynamic | Indicates if the buffer is dynamic (default is false). |
| void lmgl::renderer::VertexBuffer::bind | ( | ) | const |
Bind the vertex buffer.
Activates the vertex buffer for subsequent rendering operations.
| const BufferLayout & lmgl::renderer::VertexBuffer::get_layout | ( | ) | const |
Get the layout of the vertex buffer.
Returns a constant reference to the BufferLayout that describes the structure of the vertex data in the buffer.
| void lmgl::renderer::VertexBuffer::set_data | ( | const void * | data, |
| unsigned int | size ) |
Set the data of the vertex buffer.
Updates the contents of the vertex buffer with new data.
| data | Pointer to the new vertex data. |
| size | Size of the new vertex data in bytes. |
| void lmgl::renderer::VertexBuffer::set_layout | ( | const BufferLayout & | layout | ) |
Set the layout of the vertex buffer.
Assigns a BufferLayout to the vertex buffer, defining the structure of the vertex data.
| layout | The BufferLayout to be assigned to the vertex buffer. |
| void lmgl::renderer::VertexBuffer::unbind | ( | ) | const |
Unbind the vertex buffer.
Deactivates the vertex buffer.