- some small cleanup in vbo code
This commit is contained in:
parent
dab57fcb34
commit
ab9d2f1bf2
|
@ -42,6 +42,8 @@
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
|
||||||
|
//#define ENABLE_VBO_CODE 1
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
using namespace Shared::Graphics;
|
using namespace Shared::Graphics;
|
||||||
|
|
|
@ -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\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 \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 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%s\t\t\tdisplays verbose information in the console.",GAME_ARGS[GAME_ARG_VERBOSE_MODE]);
|
||||||
|
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
|
|
|
@ -192,14 +192,14 @@ void ModelRendererGl::renderMesh(Mesh *mesh) {
|
||||||
//vertices
|
//vertices
|
||||||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOVertices() );
|
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOVertices() );
|
||||||
glVertexPointer( 3, GL_FLOAT, 0, (char *) NULL ); // Set The Vertex Pointer To The Vertex Buffer
|
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
|
//normals
|
||||||
if(renderNormals) {
|
if(renderNormals) {
|
||||||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBONormals() );
|
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBONormals() );
|
||||||
glEnableClientState(GL_NORMAL_ARRAY);
|
glEnableClientState(GL_NORMAL_ARRAY);
|
||||||
glNormalPointer(GL_FLOAT, 0, (char *) NULL);
|
glNormalPointer(GL_FLOAT, 0, (char *) NULL);
|
||||||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
|
//glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
glDisableClientState(GL_NORMAL_ARRAY);
|
glDisableClientState(GL_NORMAL_ARRAY);
|
||||||
|
@ -213,7 +213,7 @@ void ModelRendererGl::renderMesh(Mesh *mesh) {
|
||||||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
|
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer
|
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);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -221,7 +221,7 @@ void ModelRendererGl::renderMesh(Mesh *mesh) {
|
||||||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
|
glBindBufferARB( GL_ARRAY_BUFFER_ARB, mesh->getVBOTexCoords() );
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // Set The TexCoord Pointer To The TexCoord Buffer
|
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 {
|
else {
|
||||||
if(duplicateTexCoords) {
|
if(duplicateTexCoords) {
|
||||||
|
@ -273,6 +273,7 @@ void ModelRendererGl::renderMesh(Mesh *mesh) {
|
||||||
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, mesh->getVBOIndexes() );
|
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, mesh->getVBOIndexes() );
|
||||||
glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, (char *)NULL);
|
glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, (char *)NULL);
|
||||||
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
|
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());
|
//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() );
|
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, mesh->getVBOIndexes() );
|
||||||
glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, (char *)NULL);
|
glDrawRangeElements(GL_TRIANGLES, 0, vertexCount-1, indexCount, GL_UNSIGNED_INT, (char *)NULL);
|
||||||
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
|
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
|
||||||
|
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//printf("Rendering Mesh Normals WITHOUT VBO's\n");
|
//printf("Rendering Mesh Normals WITHOUT VBO's\n");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user