Browse Source

Made the GL demo page clean up its attributes to avoid problems on nvideo cards.

tags/2021-05-28
jules 12 years ago
parent
commit
b7ebb273d9
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      extras/Demo/Source/Demos/OpenGLDemo.cpp

+ 9
- 1
extras/Demo/Source/Demos/OpenGLDemo.cpp View File

@@ -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<OpenGLShaderProgram::Attribute> 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);
}
}


Loading…
Cancel
Save