From 7f3f995c56530af0f8c2904c1bd28296f6276ebb Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 9 Mar 2017 17:47:27 +0000 Subject: [PATCH] Improved handling of VBO/VAO's in Text3D --- src/osgText/Text3D.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/osgText/Text3D.cpp b/src/osgText/Text3D.cpp index 719f91f6a..b21927a8d 100644 --- a/src/osgText/Text3D.cpp +++ b/src/osgText/Text3D.cpp @@ -499,13 +499,17 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const // OSG_NOTICE<<"No need to apply matrix "<getRequiresSetArrays(); - state.lazyDisablingOfVertexAttributes(); - - state.setVertexPointer(_coords.get()); - state.setNormalPointer(_normals.get()); - - state.applyDisablingOfVertexAttributes(); + if (requiresSetArrays) + { + vas->lazyDisablingOfVertexAttributes(); + vas->setVertexArray(state, _coords.get()); + vas->setNormalArray(state, _normals.get()); + vas->applyDisablingOfVertexAttributes(state); + } if ((_drawMode&(~TEXT))!=0) { @@ -559,6 +563,13 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const } } + if (!usingVertexArrayObjects) + { + // unbind the VBO's if any are used. + vas->unbindVertexBufferObject(); + vas->unbindElementBufferObject(); + } + if (needToApplyMatrix) { // restore the previous modelview matrix