medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f6b52f3bf1a83cf5431a7bf4bda76ff6403aa24a
parent 39a2bdc8269f6b402a53299c97eac6393895fac5
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Oct 30 20:58:42 +0200

Use UBOs in BSP renderer

Diffstat:
bsp.cc | 11+++--------
renderer.cc | 2++
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/bsp.cc b/bsp.cc @@ -24,10 +24,9 @@ static const GLchar * const vert_src = GLSL( out vec3 frag_colour; - // layout( std140 ) uniform uniforms { - // mat4 VP; - // }; - uniform mat4 VP; + layout( std140 ) uniform uniforms { + mat4 VP; + }; void main() { gl_Position = VP * vec4( position, 1.0 ); @@ -344,10 +343,6 @@ extern "C" GAME_FRAME( game_frame ) { -game->pos ); - // TODO: remove this when we switch to UBs - glUseProgram( game->test_shader ); - glUniformMatrix4fv( game->test_un_VP, 1, GL_FALSE, glm::value_ptr( VP ) ); - renderer_begin_frame(); renderer_ub_data( test_ub, glm::value_ptr( VP ), sizeof( VP ) ); diff --git a/renderer.cc b/renderer.cc @@ -256,6 +256,8 @@ void renderer_draw_mesh( const Mesh & mesh, RenderState state ) { // TODO: check vs OpenGLState if these binds are really necessary glUseProgram( state.shader ); glBindVertexArray( mesh.vao ); + // TODO: don't hardcode 0! + glBindBufferBase( GL_UNIFORM_BUFFER, 0, state.ubs[ 0 ] ); // TODO: set depth func, bind textures, etc GLenum primitive = primitivetype_to_glenum( mesh.primitive_type );