Example #1
0
void maybe_bind_gl_buffer(unsigned int id)
{
	b6_static_assert(sizeof(GLuint) == sizeof(unsigned int));
	if (id == current_buffer_id)
		return;
	current_buffer_id = id;
	bind_gl_buffer(id);
}
Example #2
0
static void bind_vertex_array(gl_vertex_array* vertex_array) {
	glBindVertexArray(vertex_array->id);
	CHECK_GL_ERROR();
	bind_gl_buffer(&vertex_array->index_buffer);
	bind_gl_buffer(&vertex_array->vertex_buffer);
}
Example #3
0
static void upload_gl_buffer_data(gl_buffer* buffer) {
	Assert(buffer->memory && buffer->id != 0 && buffer->size != 0);
	bind_gl_buffer(buffer);
	glBufferData(buffer->target, buffer->size, buffer->memory, buffer->usage);
	CHECK_GL_ERROR();
}
Example #4
0
void maybe_unbind_gl_buffer(unsigned int id)
{
	if (id == current_buffer_id)
		bind_gl_buffer(0);
}