void OpenGL3Driver::bind_uniform(const UniformBuffer& uniform, size_t unit) { const OpenGL3UniformBuffer* buffer = static_cast<const OpenGL3UniformBuffer*>(uniform.impl()); // TODO: need to add state checks buffer->bind(current_shader_program_, unit); CHECK_GL_ERRORS(); }
void OpenGL3Driver::set_uniform(const UniformBuffer& uniform, size_t unit) { const OpenGL3UniformBuffer* buffer = static_cast<const OpenGL3UniformBuffer*>(uniform.impl()); if (state_.uniforms[unit] != uniform.id()) { buffer->bind(unit); state_.uniforms[unit] = uniform.id(); } buffer->enable(current_shader_program_, unit); CHECK_GL_ERRORS(); }