From 1778a2a6fbc108850f3d8519a8a182cec5186f4b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 21 Mar 2017 15:38:52 +0000 Subject: [PATCH] Made VAO the default for GL3 builds. Improved the handling of DisplaySettings::getVertexBufferHint() values. --- src/osg/State.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 43eed6cb6..6ec0a3d41 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -96,8 +96,14 @@ State::State(): _isVertexBufferObjectSupported = false; _isVertexArrayObjectSupported = false; +#if OSG_GL3_FEATURES + _forceVertexBufferObject = true; + _forceVertexArrayObject = true; +#else _forceVertexBufferObject = false; _forceVertexArrayObject = false; +#endif + _lastAppliedProgramObject = 0; @@ -179,8 +185,17 @@ void State::initializeExtensionProcs() _isVertexArrayObjectSupported = _glExtensions->isVAOSupported; const DisplaySettings* ds = getDisplaySettings() ? getDisplaySettings() : osg::DisplaySettings::instance().get(); - _forceVertexArrayObject = _isVertexArrayObjectSupported && (ds->getVertexBufferHint()==DisplaySettings::VERTEX_ARRAY_OBJECT); - _forceVertexBufferObject = _forceVertexArrayObject || (_isVertexBufferObjectSupported && (ds->getVertexBufferHint()==DisplaySettings::VERTEX_BUFFER_OBJECT)); + + if (ds->getVertexBufferHint()==DisplaySettings::VERTEX_BUFFER_OBJECT) + { + _forceVertexBufferObject = true; + _forceVertexArrayObject = false; + } + else if (ds->getVertexBufferHint()==DisplaySettings::VERTEX_ARRAY_OBJECT) + { + _forceVertexBufferObject = true; + _forceVertexArrayObject = true; + } OSG_NOTICE<<"_forceVertexArrayObject = "<<_forceVertexArrayObject<