diff --git a/src/osgText/TextBase.cpp b/src/osgText/TextBase.cpp index 4a2d887bb..a45e25b7b 100644 --- a/src/osgText/TextBase.cpp +++ b/src/osgText/TextBase.cpp @@ -139,7 +139,34 @@ osg::VertexArrayState* TextBase::createVertexArrayStateImplementation(osg::Rende void TextBase::compileGLObjects(osg::RenderInfo& renderInfo) const { - Drawable::compileGLObjects(renderInfo); + State& state = *renderInfo.getState(); + if (renderInfo.getState()->useVertexBufferObject(_supportsVertexBufferObjects && _useVertexBufferObjects)) + { + unsigned int contextID = state.getContextID(); + GLExtensions* extensions = state.get(); + if (state.useVertexArrayObject(_useVertexArrayObject)) + { + VertexArrayState* vas = 0; + + _vertexArrayStateList[contextID] = vas = createVertexArrayState(renderInfo); + + State::SetCurrentVertexArrayStateProxy setVASProxy(state, vas); + + state.bindVertexArrayObject(vas); + + drawImplementation(renderInfo); + + state.unbindVertexArrayObject(); + } + else + { + drawImplementation(renderInfo); + } + + // unbind the BufferObjects + extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0); + extensions->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0); + } } void TextBase::resizeGLObjectBuffers(unsigned int maxSize)