|
Brenta Engine 1.0
|
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 | Delete () |
| Delete the buffer object. | |
| int | GetId () |
| Get the buffer object id. | |
| GLenum | GetTarget () |
| Get the buffer object target. | |
| void | SetId (unsigned int id) |
| Set the buffer object id. | |
| void | SetTarget (GLenum target) |
| Set the buffer object target. | |
| void | CopyData (GLsizeiptr size, const void *data, GLenum usage) |
| Copy data to the buffer object. | |
| void | CopyVertices (GLsizeiptr size, const void *data, GLenum usage) |
| Copy data to the buffer object. | |
| void | CopyIndices (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::CopyData | ( | 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::CopyIndices | ( | 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::CopyVertices | ( | 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::Delete | ( | ) |
Delete the buffer object.
Definition at line 77 of file buffer.cpp.
| int Buffer::GetId | ( | ) |
| GLenum Buffer::GetTarget | ( | ) |
| void Buffer::SetId | ( | unsigned int | id | ) |
| void Buffer::SetTarget | ( | 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.