A thin wrapper around an OpenGL Vertex Array Object (VAO).
More...
#include <easy3d/renderer/vertex_array_object.h>
|
GLuint | id () const |
|
void | bind () |
|
void | release () const |
|
bool | create_array_buffer (GLuint &buffer, GLuint index, const void *data, std::size_t size, std::size_t dim, bool dynamic=false) |
| Creates an OpenGL array buffer and upload data to the buffer. More...
|
|
bool | create_element_buffer (GLuint &buffer, const void *data, std::size_t size, bool dynamic=false) |
|
bool | create_storage_buffer (GLuint &buffer, GLuint index, const void *data, std::size_t size) |
|
bool | update_storage_buffer (GLuint &buffer, GLintptr offset, GLsizeiptr size, const void *data) |
|
|
static bool | is_supported () |
|
static void | release_buffer (GLuint &buffer) |
| Frees the GPU memory of the buffer specified by 'handle'.
|
|
static void | get_buffer_data (GLenum target, GLuint buffer, GLintptr offset, GLsizeiptr size, void *data) |
|
static void * | map_buffer (GLenum target, GLuint buffer, GLenum access) |
|
static void | unmap_buffer (GLenum target, GLuint buffer) |
|
A thin wrapper around an OpenGL Vertex Array Object (VAO).
A VAO is an OpenGL container object that encapsulates the state needed to specify per-vertex attribute data to the OpenGL pipeline. To put it another way, a VAO remembers the states of buffer objects (i.e., vertex buffers) and their associated state (e.g. vertex attribute divisors). This allows a very easy and efficient method of switching between OpenGL buffer states for rendering different "objects" in a scene.
- Note
- This implementation is more than the standard VAO. It also provides functions for creating and managing other buffer objects (i.e., shader storage buffer).
◆ create_array_buffer()
bool create_array_buffer |
( |
GLuint & |
buffer, |
|
|
GLuint |
index, |
|
|
const void * |
data, |
|
|
std::size_t |
size, |
|
|
std::size_t |
dim, |
|
|
bool |
dynamic = false |
|
) |
| |
Creates an OpenGL array buffer and upload data to the buffer.
- Parameters
-
handle | The name of the buffer object. |
index | The index of the generic vertex attribute to be enabled. |
data | The pointer to the data. |
size | The size of the data in bytes. |
dim | The number of components per generic vertex attribute. Must be 1, 2, 3, 4. |
dynamic | The expected usage pattern is GL_STATIC_DRAW or GL_DYNAMIC_DRAW. |
- Returns
- OpenGL error code.
◆ get_buffer_data()
void get_buffer_data |
( |
GLenum |
target, |
|
|
GLuint |
buffer, |
|
|
GLintptr |
offset, |
|
|
GLsizeiptr |
size, |
|
|
void * |
data |
|
) |
| |
|
static |
Returns a subset of a buffer object's data store.
- Parameters
-
target | can be GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_SHADER_STORAGE_BUFFER, etc. |
handle | the name of the buffer object. |
offset | the offset into the buffer object's data store from which data will be returned, measured in bytes. |
size | the size in bytes of the data store region being returned. |
data | a pointer to the location where buffer object data is returned. |
The documentation for this class was generated from the following files:
- /Users/lnan/Documents/Projects/Easy3D/easy3d/renderer/vertex_array_object.h
- /Users/lnan/Documents/Projects/Easy3D/easy3d/renderer/vertex_array_object.cpp