Added optional finer grained checks for GL errors within Geometry::drawImplementation() to help track down GL errors.

Turned off the vertex attribute aliasing in ArrayDispatchers when the GLBeginEndAdapter is used.
This commit is contained in:
Robert Osfield 2009-11-13 13:25:59 +00:00
parent b3feedaf0a
commit cd2d69506b

View File

@ -913,15 +913,20 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
}
State& state = *renderInfo.getState();
bool checkForGLErrors = state.getCheckForGLErrors()==osg::State::ONCE_PER_ATTRIBUTE;
if (checkForGLErrors) state.checkGLErrors("start of Geometry::drawImplementation()");
bool useFastPath = areFastPathsUsed();
// useFastPath = false;
bool usingVertexBufferObjects = _useVertexBufferObjects && state.isVertexBufferObjectSupported();
bool handleVertexAttributes = !_vertexAttribList.empty();
ArrayDispatchers& arrayDispatchers = state.getArrayDispatchers();
arrayDispatchers.setUseVertexAttribAlias(state.getUseVertexAttributeAliasing());
arrayDispatchers.reset();
arrayDispatchers.setUseVertexAttribAlias(useFastPath && state.getUseVertexAttributeAliasing());
arrayDispatchers.setUseGLBeginEndAdapter(!useFastPath);
arrayDispatchers.activateNormalArray(_normalData.binding, _normalData.array.get(), _normalData.indices.get());
@ -996,6 +1001,9 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
unsigned int primitiveNum = 0;
if (checkForGLErrors) state.checkGLErrors("Geometry::drawImplementation() after vertex arrays setup.");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// draw the primitives themselves.
@ -1168,6 +1176,8 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
// unbind the VBO's if any are used.
state.unbindVertexBufferObject();
state.unbindElementBufferObject();
if (checkForGLErrors) state.checkGLErrors("end of Geometry::drawImplementation().");
}
class AttributeFunctorArrayVisitor : public ArrayVisitor