4 #include "uniformbuffer.h" 6 void UniformBufferBase::destroy() {
8 GLuint buffer = _buffer;
9 cleanup([buffer]() { V_GL(glDeleteBuffers(1, &buffer)); });
14 void UniformBufferBase::update(
const void *data,
size_t size) {
16 V_GL(glGenBuffers(1, &_buffer));
18 V_GL(glBindBuffer(GL_UNIFORM_BUFFER, _buffer));
19 V_GL(glBufferData(GL_UNIFORM_BUFFER, size, data, GL_DYNAMIC_DRAW));
22 void UniformBufferBase::bind(
size_t binding_point) {
23 V_GL(glBindBufferBase(GL_UNIFORM_BUFFER, binding_point, _buffer));
26 void UniformBufferBase::bind(
size_t binding_point,
size_t offset,
size_t size) {
27 V_GL(glBindBufferRange(GL_UNIFORM_BUFFER, binding_point, _buffer, offset,