Skip to content

Commit

Permalink
Fixed Geometry::drawImplmentation() handling of VBO's to prevent them…
Browse files Browse the repository at this point in the history
… from being used when display lists are used.
  • Loading branch information
robertosfield committed Apr 16, 2018
1 parent 1542919 commit 9d72bf4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/osg/Geometry.cpp
Expand Up @@ -877,6 +877,12 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const

State& state = *renderInfo.getState();

bool usingVertexBufferObjects = state.useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects);
bool usingVertexArrayObjects = usingVertexBufferObjects && state.useVertexArrayObject(_useVertexArrayObject);

osg::VertexArrayState* vas = state.getCurrentVertexArrayState();
vas->setVertexBufferObjectSupported(usingVertexBufferObjects);

bool checkForGLErrors = state.getCheckForGLErrors()==osg::State::ONCE_PER_ATTRIBUTE;
if (checkForGLErrors) state.checkGLErrors("start of Geometry::drawImplementation()");

Expand All @@ -892,13 +898,9 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const

drawPrimitivesImplementation(renderInfo);

bool usingVertexBufferObjects = state.useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects);
bool usingVertexArrayObjects = usingVertexBufferObjects && state.useVertexArrayObject(_useVertexArrayObject);

if (usingVertexBufferObjects && !usingVertexArrayObjects)
{
// unbind the VBO's if any are used.
osg::VertexArrayState* vas = state.getCurrentVertexArrayState();
vas->unbindVertexBufferObject();
vas->unbindElementBufferObject();
}
Expand Down

0 comments on commit 9d72bf4

Please sign in to comment.