Added intialization of the VAO in Geometry::compileGLObjects() and refined the invocation of updates to the VAO
This commit is contained in:
parent
078598872f
commit
4131d2da34
@ -88,6 +88,8 @@ public:
|
||||
_currentEBO = 0;
|
||||
}
|
||||
|
||||
void resetBufferObjectPointers() { _currentVBO = 0; _currentEBO = 0; }
|
||||
|
||||
void assignAllDispatchers();
|
||||
|
||||
virtual void assignVertexArrayDispatcher();
|
||||
|
@ -628,6 +628,15 @@ void Drawable::draw(RenderInfo& renderInfo) const
|
||||
{
|
||||
_vertexArrayStateList[contextID] = vas = setUpVertexArrayState(renderInfo, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
vas->setRequiresSetArrays(getDataVariance()==osg::Object::DYNAMIC);
|
||||
}
|
||||
|
||||
if (vas->getRequiresSetArrays())
|
||||
{
|
||||
vas->resetBufferObjectPointers();
|
||||
}
|
||||
|
||||
State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
|
||||
|
||||
@ -635,8 +644,6 @@ void Drawable::draw(RenderInfo& renderInfo) const
|
||||
|
||||
drawInner(renderInfo);
|
||||
|
||||
vas->setRequiresSetArrays(getDataVariance()==osg::Object::DYNAMIC);
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -699,8 +699,6 @@ VertexArrayState* Geometry::setUpVertexArrayState(RenderInfo& renderInfo, bool u
|
||||
void Geometry::compileGLObjects(RenderInfo& renderInfo) const
|
||||
{
|
||||
State& state = *renderInfo.getState();
|
||||
const DisplaySettings* ds = state.getDisplaySettings() ? state.getDisplaySettings() : osg::DisplaySettings::instance();
|
||||
|
||||
bool useVertexArrays = _supportsVertexBufferObjects &&
|
||||
_useVertexBufferObjects &&
|
||||
renderInfo.getState()->isVertexBufferObjectSupported();
|
||||
@ -762,9 +760,19 @@ void Geometry::compileGLObjects(RenderInfo& renderInfo) const
|
||||
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0);
|
||||
extensions->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);
|
||||
|
||||
const DisplaySettings* ds = state.getDisplaySettings() ? state.getDisplaySettings() : osg::DisplaySettings::instance();
|
||||
if (ds->getGeometryImplementation()==DisplaySettings::VERTEX_ARRAY_OBJECT && !bufferObjects.empty())
|
||||
{
|
||||
setUpVertexArrayState(renderInfo, true);
|
||||
VertexArrayState* vas = 0;
|
||||
|
||||
_vertexArrayStateList[contextID] = vas = setUpVertexArrayState(renderInfo, true);
|
||||
|
||||
State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas);
|
||||
|
||||
vas->bindVertexArrayObject();
|
||||
|
||||
|
||||
drawVertexArraysImplementation(renderInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -346,20 +346,6 @@ VertexArrayState::VertexArrayState(osg::GLExtensions* ext):
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
osg::GLBufferObject* VertexArrayState::getGLBufferObject(osg::Array* array)
|
||||
{
|
||||
if (_ext->isBufferObjectSupported && array->getBufferObject())
|
||||
{
|
||||
return array->getBufferObject()->getOrCreateGLBufferObject(_ext->contextID);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void VertexArrayState::generateVretexArrayObject()
|
||||
{
|
||||
_ext->glGenVertexArrays(1, &_vertexArrayObject);
|
||||
|
Loading…
Reference in New Issue
Block a user