Added lazy state updating for vertex array object binding/unbinding
This commit is contained in:
@@ -642,7 +642,7 @@ void Drawable::draw(RenderInfo& renderInfo) const
|
||||
|
||||
State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
|
||||
|
||||
vas->bindVertexArrayObject();
|
||||
state.bindVertexArrayObject(vas);
|
||||
|
||||
drawInner(renderInfo);
|
||||
|
||||
@@ -652,7 +652,11 @@ void Drawable::draw(RenderInfo& renderInfo) const
|
||||
}
|
||||
|
||||
// TODO, add check against whether VAO is active and supported
|
||||
if (state.getCurrentVertexArrayState()) state.getCurrentVertexArrayState()->bindVertexArrayObject();
|
||||
if (state.getCurrentVertexArrayState())
|
||||
{
|
||||
//OSG_NOTICE<<"state.getCurrentVertexArrayState()->getVertexArrayObject()="<< state.getCurrentVertexArrayState()->getVertexArrayObject()<<std::endl;
|
||||
state.bindVertexArrayObject(state.getCurrentVertexArrayState());
|
||||
}
|
||||
|
||||
|
||||
#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
|
||||
|
||||
@@ -820,9 +820,11 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
|
||||
|
||||
State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
|
||||
|
||||
vas->bindVertexArrayObject();
|
||||
state.bindVertexArrayObject(vas);
|
||||
|
||||
drawVertexArraysImplementation(renderInfo);
|
||||
|
||||
state.unbindVertexArrayObject();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -89,6 +89,7 @@ State::State():
|
||||
_currentClientActiveTextureUnit=0;
|
||||
|
||||
_currentPBO = 0;
|
||||
_currentVAO = 0;
|
||||
|
||||
_isSecondaryColorSupported = false;
|
||||
_isFogCoordSupported = false;
|
||||
|
||||
@@ -861,10 +861,12 @@ void SharedGeometry::compileGLObjects(osg::RenderInfo& renderInfo) const
|
||||
|
||||
osg::State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
|
||||
|
||||
vas->bindVertexArrayObject();
|
||||
state.bindVertexArrayObject(vas);
|
||||
|
||||
if (vbo_glBufferObject) vas->bindVertexBufferObject(vbo_glBufferObject);
|
||||
if (ebo_glBufferObject) vas->bindElementBufferObject(ebo_glBufferObject);
|
||||
|
||||
state.unbindVertexArrayObject();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user