From ab9d2f1bf2353cd653fa110997dd066ae5de32e8 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Fri, 4 Feb 2011 02:26:55 +0000 Subject: [PATCH] - some small cleanup in vbo code --- source/glest_game/graphics/renderer.h | 2 ++ source/glest_game/main/main.cpp | 1 + .../sources/graphics/gl/model_renderer_gl.cpp | 10 ++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/source/glest_game/graphics/renderer.h b/source/glest_game/graphics/renderer.h index 68404b96..cab14802 100644 --- a/source/glest_game/graphics/renderer.h +++ b/source/glest_game/graphics/renderer.h @@ -42,6 +42,8 @@ #include "leak_dumper.h" +//#define ENABLE_VBO_CODE 1 + namespace Glest{ namespace Game{ using namespace Shared::Graphics; diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 5c6bf178..c0fefebe 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -829,6 +829,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) { printf("\n \t\tWhere x is an optional property name to filter (default shows all)."); printf("\n \t\texample: %s %s=DebugMode",argv0,GAME_ARGS[GAME_ARG_SHOW_INI_SETTINGS]); printf("\n%s\t\tdisables stack backtrace on errors.",GAME_ARGS[GAME_ARG_DISABLE_BACKTRACE]); + printf("\n%s\t\tdisables trying to use Vertex Buffer Objects.",GAME_ARGS[GAME_ARG_DISABLE_VBO]); printf("\n%s\t\t\tdisplays verbose information in the console.",GAME_ARGS[GAME_ARG_VERBOSE_MODE]); printf("\n\n"); diff --git a/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp b/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp index 4b56dc3a..3ae50f5f 100644 --- a/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp @@ -192,14 +192,14 @@ void ModelRendererGl::renderMesh(Mesh *mesh) { //vertices glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOVertices() ); glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL ); // Set The Vertex Pointer To The Vertex Buffer - glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); + //glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); //normals if(renderNormals) { glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBONormals() ); glEnableClientState(GL_NORMAL_ARRAY); glNormalPointer(GL_FLOAT, 0, (char *) NULL); - glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); + //glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); } else{ glDisableClientState(GL_NORMAL_ARRAY); @@ -213,7 +213,7 @@ void ModelRendererGl::renderMesh(Mesh *mesh) { glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() ); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer - glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); + //glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); } glActiveTexture(GL_TEXTURE0); @@ -221,7 +221,7 @@ void ModelRendererGl::renderMesh(Mesh *mesh) { glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() ); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer - glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); + //glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); } else { if(duplicateTexCoords) { @@ -273,6 +273,7 @@ void ModelRendererGl::renderMesh(Mesh *mesh) { glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, mesh->getVBOIndexes() ); glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, (char *)NULL); glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); + glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); //glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, mesh->getIndices()); } @@ -312,6 +313,7 @@ void ModelRendererGl::renderMeshNormals(Mesh *mesh) { glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, mesh->getVBOIndexes() ); glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, (char *)NULL); glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); + glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 ); } else { //printf("Rendering Mesh Normals WITHOUT VBO's\n");