|
|
|
|
@ -220,6 +220,28 @@ getGLTexture(GLContext* gl_ctx, Texture* diffuse_img)
|
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GLBuffer* initGLBackingBuffer(GLContext* gl_ctx, |
|
|
|
|
MemoryArena* arena, |
|
|
|
|
const char* name, |
|
|
|
|
GLenum data_type, |
|
|
|
|
u32 buf_size, |
|
|
|
|
void* data) |
|
|
|
|
{ |
|
|
|
|
GLBuffer* buf = getFreeUBO(gl_ctx); |
|
|
|
|
glGenBuffers(1, &buf->id); |
|
|
|
|
buf->target = GL_UNIFORM_BUFFER; |
|
|
|
|
buf->data_type = data_type; |
|
|
|
|
buf->data_size = buf_size; |
|
|
|
|
buf->name = arenaCopyCStr(arena, name); |
|
|
|
|
|
|
|
|
|
glBindBuffer(buf->target, buf->id); |
|
|
|
|
glBufferData(buf->target, buf->data_size, data, GL_DYNAMIC_DRAW); |
|
|
|
|
buf->binding_idx = gl_ctx->binding_count++; |
|
|
|
|
glBindBufferBase(buf->target, buf->binding_idx, buf->id); |
|
|
|
|
|
|
|
|
|
return buf; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
updateGLBuffer(GLBuffer* gl_buf, void* data) |
|
|
|
|
{ |
|
|
|
|
|