Merge pull request #311 from eligovision/master

Geometry::compileGLObjects function VAO fix
This commit is contained in:
OpenSceneGraph git repository
2017-08-22 09:22:41 +01:00
committed by GitHub

View File

@@ -791,6 +791,9 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
if ((*itr)->getBufferObject()) bufferObjects.insert((*itr)->getBufferObject());
}
if (bufferObjects.empty())
return; // no buffers, nothing to compile
//osg::ElapsedTime timer;
// now compile any buffer objects that require it.
@@ -808,11 +811,7 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
// OSG_NOTICE<<"Time to compile "<<timer.elapsedTime_m()<<"ms"<<std::endl;
// unbind the BufferObjects
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0);
extensions->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
if (state.useVertexArrayObject(_useVertexArrayObject) && !bufferObjects.empty())
if (state.useVertexArrayObject(_useVertexArrayObject))
{
VertexArrayState* vas = 0;
@@ -826,6 +825,10 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
state.unbindVertexArrayObject();
}
// unbind the BufferObjects
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0);
extensions->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
}
else
{