Fixed Geometry::drawImplmentation() handling of VBO's to prevent them from being used when display lists are used.

This commit is contained in:
Robert Osfield 2018-04-16 15:05:11 +01:00
parent 15429198b8
commit 9d72bf4712

View File

@ -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()");
@ -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();
}