4#include "vertex_buffer.h"
60 return vertex_buffer::resize(ctx,
reinterpret_cast<const uint8_t*
>(array.data()),
sizeof(T) * array.size());
83 return vertex_buffer::replace(ctx, 0,
reinterpret_cast<const uint8_t*
>(array.data()),
sizeof(T) * array.size());
93 return size_in_bytes !=
sizeof(T) ?
resize(ctx, data) :
replace(ctx, data);
103 return size_in_bytes !=
sizeof(T) ?
resize(ctx, array) :
replace(ctx, array);
base class for all drawables, which is independent of the used rendering API.
VertexBufferUsage usage
usage defaults to VBU_STATIC_DRAW
a vertex buffer is an unstructured memory block on the GPU.
bool resize(const context &ctx, size_t size_in_bytes)
resize vertex buffer to size size given in bytes clearing all data
bool create(const context &ctx, size_t size_in_bytes)
create empty vertex buffer of size size given in bytes
bool replace(const context &ctx, size_t buffer_offset_in_bytes, const T *array_ptr, size_t nr_elements)
replace part (starting at byte offset buffer_offset_in_bytes) or whole vertex buffer content from nr_...
VertexBufferUsage
Provides vertex buffer usage hints as defined in OpenGL.
@ VBU_STREAM_COPY
Modified once and used at most a few times; Modified by reading data from the GL, and used as the sou...
VertexBufferType
Provides vertex buffer types to allow implicit binding.
@ VBT_UNIFORM
The buffer contains uniforms and will be bound to GL_UNIFORM_BUFFER.
this header is dependency free