![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Core/GL/VertexBuffer.h>
Wrapper around an OpenGL Vertex Array Object (VAO) to define the vertex attribute specification for rendering. More...
Wrapper around an OpenGL Vertex Array Object (VAO) to define the vertex attribute specification for rendering.
In the vast majority of use cases you do not need to use this class explicitly because VertexBuffer will take care of it internally. However, it may be useful in one of the following situations:
After instantiating a VertexArrayObject you must call setAttributes() once in order to configure the VBO and optionally IBO mapping to the shader input. Afterwards, you can call its draw() functions as many times as you like. Keep in mind that the currently bound VAO is part of the global OpenGL state and other library calls may change it at any time.
Public Member Functions | |
void | setAttributes (const VertexBuffer &vbo, const IndexBuffer *ibo=nullptr) |
Configure the VAO with the current attribute configuration of the vertex buffer and an optional index buffer. | |
void | setAttributes (std::initializer_list< std::pair< const VertexBuffer *, std::initializer_list< int > > > vboMapping, const IndexBuffer *ibo=nullptr) |
Configure the VAO with the current attribute configuration of multiple vertex buffers and an optional index buffer. | |
void | bind () const |
Rebind the VAO, useful if you issued any other rendering command in between. | |
void | draw (Primitive mode) const |
Renders a single primitive using all vertices of the previously bound VBOs/IBO. | |
void | drawInstanced (Primitive mode, int32_t count) const |
Renders multiple instances of the same primitive using all vertices of the previously bound VBOs/IBO. | |
Static Public Member Functions | |
static void | unbind () |
Unbind any previously bound VAO. | |
void setAttributes | ( | const VertexBuffer & | vbo, |
const IndexBuffer * | ibo = nullptr ) |
Configure the VAO with the current attribute configuration of the vertex buffer and an optional index buffer.
Use the other overload to configure the VAO to use vertex data from multiple VBOs.
void setAttributes | ( | std::initializer_list< std::pair< const VertexBuffer *, std::initializer_list< int > > > | vboMapping, |
const IndexBuffer * | ibo = nullptr ) |
Configure the VAO with the current attribute configuration of multiple vertex buffers and an optional index buffer.
vboMapping receives a list of vertex buffers paired with a list of the vertex buffer input locations for each attribute in the VBO. All provided VBOs must hold the same number of elements per attribute. The VertexBuffer pointers must not be null.