medfall

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

commit 2f5e3e77f309b8a00bbc694670b2e69599d175c1
parent 8db56f9768069c4a4f6f616f6011b14d8838a45e
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Mon Sep  5 22:03:05 -0700

Don't try to render uninitialised BTTs

Diffstat:
gpubtt.cc | 4++++
gpubtt.h | 2+-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gpubtt.cc b/gpubtt.cc @@ -151,9 +151,13 @@ void gpubtt_destroy( GPUBTT * const gpubtt ) { glDeleteTextures( 1, &gpubtt->tex_normals ); glDeleteBuffers( 1, &gpubtt->vbo_verts ); glDeleteVertexArrays( 1, &gpubtt->vao ); + + gpubtt->vbo_verts = 0; } void gpubtt_render( const GPUBTT * const gpubtt, const GLuint un_normals ) { + if( gpubtt->vbo_verts == 0 ) return; + glBindVertexArray( gpubtt->vao ); glActiveTexture( GL_TEXTURE0 ); diff --git a/gpubtt.h b/gpubtt.h @@ -8,7 +8,7 @@ struct GPUBTT { GLuint vao; - GLuint vbo_verts; + GLuint vbo_verts = 0; GLuint tex_normals; GLuint tex_horizons; u32 num_verts;