From b7ebb273d930c5079efe9a4eaa23c623eb230c88 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 11 Dec 2013 21:46:47 +0000 Subject: [PATCH] Made the GL demo page clean up its attributes to avoid problems on nvideo cards. --- extras/Demo/Source/Demos/OpenGLDemo.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extras/Demo/Source/Demos/OpenGLDemo.cpp b/extras/Demo/Source/Demos/OpenGLDemo.cpp index eb8f9fa6f2..f6b3771f18 100644 --- a/extras/Demo/Source/Demos/OpenGLDemo.cpp +++ b/extras/Demo/Source/Demos/OpenGLDemo.cpp @@ -82,6 +82,14 @@ struct OpenGLDemoClasses } } + void disable (OpenGLContext& openGLContext) + { + if (position != nullptr) openGLContext.extensions.glDisableVertexAttribArray (position->attributeID); + if (normal != nullptr) openGLContext.extensions.glDisableVertexAttribArray (normal->attributeID); + if (sourceColour != nullptr) openGLContext.extensions.glDisableVertexAttribArray (sourceColour->attributeID); + if (texureCoordIn != nullptr) openGLContext.extensions.glDisableVertexAttribArray (texureCoordIn->attributeID); + } + ScopedPointer position, normal, sourceColour, texureCoordIn; private: @@ -145,8 +153,8 @@ struct OpenGLDemoClasses vertexBuffer.bind(); attributes.enable (openGLContext); - glDrawElements (GL_TRIANGLES, vertexBuffer.numIndices, GL_UNSIGNED_INT, 0); + attributes.disable (openGLContext); } }