Improved the checks against VBO+VAO usage and cleaned up setup.

This commit is contained in:
Robert Osfield
2017-03-08 18:12:37 +00:00
parent 9b32395772
commit 854dac5340
2 changed files with 3 additions and 6 deletions

View File

@@ -624,7 +624,6 @@ void Drawable::compileGLObjects(RenderInfo& renderInfo) const
void Drawable::draw(RenderInfo& renderInfo) const
{
State& state = *renderInfo.getState();
bool useVertexArrayObject = state.useVertexArrayObject(_useVertexArrayObject);
if (useVertexArrayObject)
@@ -634,16 +633,13 @@ void Drawable::draw(RenderInfo& renderInfo) const
VertexArrayState* vas = _vertexArrayStateList[contextID].get();
if (!vas)
{
_vertexArrayStateList[contextID] = vas = createVertexArrayState(renderInfo, true);
// OSG_NOTICE<<" Geometry::draw() "<<this<<", assigned _vertexArrayStateList[renderInfo.getContextID()]="<<_vertexArrayStateList[renderInfo.getContextID()].get()<<", vas="<<vas<< std::endl;
_vertexArrayStateList[contextID] = vas = createVertexArrayState(renderInfo);
}
else
{
// vas->setRequiresSetArrays(getDataVariance()==osg::Object::DYNAMIC);
// OSG_NOTICE<<" Geometry::draw() "<<this<<", reusing _vertexArrayStateList[renderInfo.getContextID()]="<<_vertexArrayStateList[renderInfo.getContextID()].get()<<", vas="<<vas<< std::endl;
}
State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
vas->bindVertexArrayObject();

View File

@@ -858,7 +858,8 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
drawPrimitivesImplementation(renderInfo);
if (!state.useVertexArrayObject(_useVertexArrayObject) || state.getCurrentVertexArrayState()->getRequiresSetArrays())
if (renderInfo.getState()->useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects) &&
(!state.useVertexArrayObject(_useVertexArrayObject) || state.getCurrentVertexArrayState()->getRequiresSetArrays()))
{
// unbind the VBO's if any are used.
state.unbindVertexBufferObject();