From 2c019d579fc37039367ca689667fa5f81be5b0b6 Mon Sep 17 00:00:00 2001 From: erwin coumans Date: Thu, 22 Aug 2013 23:15:37 -0700 Subject: [PATCH] reduce memory allocation, lack of GPU memory totally destroys performance on my GTX 650M on the Macbook retina add some keys to toggle gui drawing and shadows --- Demos3/GpuDemos/main_opengl3core.cpp | 13 ++++++++++++- btgui/OpenGLWindow/GLInstancingRenderer.cpp | 2 +- btgui/OpenGLWindow/OpenGLInclude.h | 9 ++++++++- src/Bullet3OpenCL/RigidBody/b3Config.h | 2 +- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Demos3/GpuDemos/main_opengl3core.cpp b/Demos3/GpuDemos/main_opengl3core.cpp index 60fa8954b..e9f004bda 100644 --- a/Demos3/GpuDemos/main_opengl3core.cpp +++ b/Demos3/GpuDemos/main_opengl3core.cpp @@ -64,6 +64,7 @@ static void MyResizeCallback( float width, float height) b3gWindowInterface* window=0; GwenUserInterface* gui = 0; bool gPause = false; +bool gDrawGui = true; bool gStep = false; bool gReset = false; @@ -222,9 +223,19 @@ static void MyMouseButtonCallback(int button, int state, float x, float y) } } +extern bool useShadowMap; void MyKeyboardCallback(int key, int state) { + if (key=='s' && state) + { + useShadowMap=!useShadowMap; + } + if (key=='g' && state) + { + gDrawGui = !gDrawGui; + } + if (key==B3G_ESCAPE && window) { window->setRequestExit(); @@ -891,7 +902,7 @@ int main(int argc, char* argv[]) { B3_PROFILE("gui->draw"); - if (gui) + if (gui && gDrawGui) gui->draw(g_OpenGLWidth,g_OpenGLHeight); } err = glGetError(); diff --git a/btgui/OpenGLWindow/GLInstancingRenderer.cpp b/btgui/OpenGLWindow/GLInstancingRenderer.cpp index c1b16f0b7..6bbba8f4a 100644 --- a/btgui/OpenGLWindow/GLInstancingRenderer.cpp +++ b/btgui/OpenGLWindow/GLInstancingRenderer.cpp @@ -1512,7 +1512,7 @@ void GLInstancingRenderer::renderSceneInternal(int renderMode) #ifndef __APPLE__ glEnable(GL_POINT_SPRITE_ARB); - glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); +// glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); #endif glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); diff --git a/btgui/OpenGLWindow/OpenGLInclude.h b/btgui/OpenGLWindow/OpenGLInclude.h index a43f00be8..665bdd725 100644 --- a/btgui/OpenGLWindow/OpenGLInclude.h +++ b/btgui/OpenGLWindow/OpenGLInclude.h @@ -39,7 +39,14 @@ subject to the following restrictions: #endif //_WINDOWS #endif //APPLE - +//disable glGetError +//#undef glGetError +//#define glGetError MyGetError +// +//GLenum inline MyGetError() +//{ +// return 0; +//} ///on Linux only glDrawElementsInstancedARB is defined?!? //#ifdef __linux diff --git a/src/Bullet3OpenCL/RigidBody/b3Config.h b/src/Bullet3OpenCL/RigidBody/b3Config.h index 7d484856c..e23fe11a5 100644 --- a/src/Bullet3OpenCL/RigidBody/b3Config.h +++ b/src/Bullet3OpenCL/RigidBody/b3Config.h @@ -32,7 +32,7 @@ struct b3Config m_maxConvexShapes = m_maxConvexBodies; m_maxBroadphasePairs = 16*m_maxConvexBodies; m_maxContactCapacity = m_maxBroadphasePairs; - m_compoundPairCapacity = 16*1524*1024; + m_compoundPairCapacity = 1024*1024; } };