Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
Data in the graphics memory. More...
#include <gf/VertexBuffer.h>
Public Member Functions | |
VertexBuffer () | |
Default constructor. More... | |
~VertexBuffer () | |
Destructor. More... | |
VertexBuffer (const VertexBuffer &)=delete | |
Deleted copy constructor. More... | |
VertexBuffer & | operator= (const VertexBuffer &)=delete |
Deleted copy assignment. More... | |
VertexBuffer (VertexBuffer &&other) | |
Move constructor. More... | |
VertexBuffer & | operator= (VertexBuffer &&other) |
Move assignment. More... | |
void | load (const Vertex *vertices, std::size_t count, PrimitiveType type) |
Load an array of vertices. More... | |
void | load (const Vertex *vertices, const uint16_t *indices, std::size_t count, PrimitiveType type) |
Load an array of vertices and their indices. More... | |
bool | hasArrayBuffer () const |
Check if there is an array buffer. More... | |
bool | hasElementArrayBuffer () const |
Check if there is an element array buffer. More... | |
std::size_t | getCount () const |
Get the count of vertices or indices. More... | |
PrimitiveType | getPrimitiveType () const |
Get the primitive type of the data in the buffer. More... | |
Static Public Member Functions | |
static void | bind (const VertexBuffer *buffer) |
Binds a vertex buffer. More... | |
Data in the graphics memory.
A vertex buffer is a buffer that resides directly in the graphics memory. The advantage is that the draw operations are faster than uploading data each time. The drawback is that the data must not change, i.e. data can be loaded only once.
In gf, a vertex buffer can be used directly. But the main usage is for drawable entities that can upload the final geometry and give the corresponding vertex buffer.
Usage:
gf::VertexBuffer::VertexBuffer | ( | ) |
Default constructor.
gf::VertexBuffer::~VertexBuffer | ( | ) |
Destructor.
|
delete |
Deleted copy constructor.
gf::VertexBuffer::VertexBuffer | ( | VertexBuffer && | other | ) |
Move constructor.
|
static |
Binds a vertex buffer.
This function is for internal use only.
buffer | A pointer to a buffer or nullptr |
|
inline |
Get the count of vertices or indices.
This function returns the count
parameter given in VertexBuffer::load().
|
inline |
Get the primitive type of the data in the buffer.
This function returns the type
parameter given in VertexBuffer::load().
|
inline |
Check if there is an array buffer.
|
inline |
Check if there is an element array buffer.
void gf::VertexBuffer::load | ( | const Vertex * | vertices, |
std::size_t | count, | ||
PrimitiveType | type | ||
) |
Load an array of vertices.
vertices | Pointer to the vertices |
count | Number of vertices in the array |
type | Type of primitives to draw |
void gf::VertexBuffer::load | ( | const Vertex * | vertices, |
const uint16_t * | indices, | ||
std::size_t | count, | ||
PrimitiveType | type | ||
) |
Load an array of vertices and their indices.
vertices | Pointer to the vertices |
indices | Pointer to the indices |
count | Number of indices in the array |
type | Type of primitives to draw |
|
delete |
Deleted copy assignment.
VertexBuffer& gf::VertexBuffer::operator= | ( | VertexBuffer && | other | ) |
Move assignment.