Restructred the enabling of vertex array object support to allow one to set enable the default via osg::State.

Added OSG_VERTEX_BUFFER_HINT env var to osg::DisplaySettings with VERTEX_BUFFER_OBJECT/VBO, VERTEX_ARRAY_OBJECT/VAO and NO_PREFERENCE to allow one to foce on VBO or VAO usage.

Restructred BufferObject assigned in osg::Geometry

Added
This commit is contained in:
Robert Osfield
2016-08-12 18:44:38 +01:00
parent d8fdf33be5
commit 94891778c4
10 changed files with 175 additions and 116 deletions

View File

@@ -96,7 +96,9 @@ State::State():
_isFogCoordSupported = false;
_isVertexBufferObjectSupported = false;
_isVertexArrayObjectSupported = false;
_useVertexArrayObject = false;
_forceVertexBufferObject = false;
_forceVertexArrayObject = false;
_lastAppliedProgramObject = 0;
@@ -176,7 +178,8 @@ void State::initializeExtensionProcs()
_isVertexArrayObjectSupported = _glExtensions->isVAOSupported;
const DisplaySettings* ds = getDisplaySettings() ? getDisplaySettings() : osg::DisplaySettings::instance();
_useVertexArrayObject = _isVertexArrayObjectSupported && (ds->getGeometryImplementation()==DisplaySettings::VERTEX_ARRAY_OBJECT);
_forceVertexArrayObject = _isVertexArrayObjectSupported && (ds->getVertexBufferHint()==DisplaySettings::VERTEX_ARRAY_OBJECT);
_forceVertexBufferObject = _forceVertexArrayObject || (_isVertexBufferObjectSupported && (ds->getVertexBufferHint()==DisplaySettings::VERTEX_BUFFER_OBJECT));
// Set up up global VertexArrayState object