Brenta Engine 1.1
|
Buffer wrapper around OpenGL buffer objects. More...
#include <buffer.hpp>
Public Member Functions | |
buffer () | |
Default constructor, does nothing. | |
buffer (GLenum input_target) | |
Constructor that creates a buffer object. | |
void | bind () |
Bind the buffer object. | |
void | unbind () |
Unbind the buffer object. | |
void | destroy () |
Delete the buffer object. | |
int | get_id () |
Get the buffer object id. | |
GLenum | get_target () |
Get the buffer object target. | |
void | set_id (unsigned int id) |
Set the buffer object id. | |
void | set_target (GLenum target) |
Set the buffer object target. | |
void | copy_data (GLsizeiptr size, const void *data, GLenum usage) |
Copy data to the buffer object. | |
void | copy_vertices (GLsizeiptr size, const void *data, GLenum usage) |
Copy data to the buffer object. | |
void | copy_indices (GLsizeiptr size, const void *data, GLenum usage) |
Copy data to the buffer object. | |
Data Fields | |
unsigned int | id |
Buffer object id, generated by OpenGL. | |
GLenum | target |
Buffer object target (like GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER...) | |
Buffer wrapper around OpenGL buffer objects.
This class is a wrapper around OpenGL buffer objects. It provides a simple interface to create, bind, unbind and delete buffer objects. It also provides methods to copy data to the buffer objects.
This class offers methods to:
Definition at line 49 of file buffer.hpp.
|
inline |
Default constructor, does nothing.
Definition at line 65 of file buffer.hpp.
buffer::buffer | ( | GLenum | input_target | ) |
Constructor that creates a buffer object.
target | Buffer object target |
This constructor creates a buffer object with the specified target. It calls the OpenGL function glGenBuffers to generate a buffer object id and glBindBuffer to bind the buffer object. The buffer has a default destructor that deletes the buffer object when it goes out of scope.
Definition at line 34 of file buffer.cpp.
void buffer::bind | ( | ) |
Bind the buffer object.
Buffers must be bound before they can be used!
Definition at line 62 of file buffer.cpp.
void buffer::copy_data | ( | GLsizeiptr | size, |
const void * | data, | ||
GLenum | usage ) |
Copy data to the buffer object.
size | Size of the data in bytes |
data | Pointer to the data |
usage | OpenGL usage hint (like GL_STATIC_DRAW) |
This method copies data to the buffer object. The size of the data is specified in bytes, the data is a pointer to the data and the usage is an OpenGL usage hint.
Definition at line 41 of file buffer.cpp.
void buffer::copy_indices | ( | GLsizeiptr | size, |
const void * | data, | ||
GLenum | usage ) |
Copy data to the buffer object.
size | Size of the data in bytes |
data | Pointer to the data |
usage | OpenGL usage hint (like GL_STATIC_DRAW) |
Same as CopyVertices but for target GL_ELEMENT_ARRAY_BUFFER.
Definition at line 46 of file buffer.cpp.
void buffer::copy_vertices | ( | GLsizeiptr | size, |
const void * | data, | ||
GLenum | usage ) |
Copy data to the buffer object.
size | Size of the data in bytes |
data | Pointer to the data |
usage | OpenGL usage hint (like GL_STATIC_DRAW) |
Same as Copydata but for target GL_ARRAY_BUFFER. The naming is more specific to the use case.
Definition at line 54 of file buffer.cpp.
void buffer::destroy | ( | ) |
Delete the buffer object.
Definition at line 77 of file buffer.cpp.
int buffer::get_id | ( | ) |
GLenum buffer::get_target | ( | ) |
void buffer::set_id | ( | unsigned int | id | ) |
void buffer::set_target | ( | GLenum | target | ) |
Set the buffer object target.
target | Buffer object target |
Definition at line 102 of file buffer.cpp.
void buffer::unbind | ( | ) |
Unbind the buffer object.
Definition at line 72 of file buffer.cpp.
unsigned int brenta::types::buffer::id |
Buffer object id, generated by OpenGL.
Definition at line 55 of file buffer.hpp.
GLenum brenta::types::buffer::target |
Buffer object target (like GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER...)
Definition at line 60 of file buffer.hpp.