From 22b8a5cc0f7143864d2b218ea92765d6fbe4da6b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 23 Feb 2017 18:36:35 +0000 Subject: [PATCH] Added missing relaseGLObjects()/resizeGLObjects(). Reordered calls to make it easier to read and see patterns. --- src/osgText/Text.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 186d00bd1..4e45a17bc 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -1519,9 +1519,9 @@ void Text::renderWithPolygonOffset(osg::State& state, const osg::Vec4& colorMult const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { + glPolygonOffset(0.1f * osg::PolygonOffset::getFactorMultiplier(), osg::PolygonOffset::getUnitsMultiplier() * (max_backdrop_index-backdrop_index) ); + state.setVertexPointer( transformedBackdropCoords.get()); - glPolygonOffset(0.1f * osg::PolygonOffset::getFactorMultiplier(), - osg::PolygonOffset::getUnitsMultiplier() * (max_backdrop_index-backdrop_index) ); state.drawQuads(0,transformedBackdropCoords->size()); } } @@ -1632,10 +1632,10 @@ void Text::renderWithDepthRange(osg::State& state, const osg::Vec4& colorMultipl const GlyphQuads::Coords& transformedBackdropCoords = glyphquad._transformedBackdropCoords[backdrop_index]; if (transformedBackdropCoords.valid() && !transformedBackdropCoords->empty()) { - state.setVertexPointer( transformedBackdropCoords.get()); double offset = double(max_backdrop_index-backdrop_index)*0.0001; glDepthRange( offset, 1.0+offset); + state.setVertexPointer( transformedBackdropCoords.get()); state.drawQuads(0,transformedBackdropCoords->size()); } } @@ -1881,6 +1881,8 @@ void Text::GlyphQuads::initGPUBufferObjects() void Text::GlyphQuads::resizeGLObjectBuffers(unsigned int maxSize) { _coords->resizeGLObjectBuffers(maxSize); + _texcoords->resizeGLObjectBuffers(maxSize); + _colorCoords->resizeGLObjectBuffers(maxSize); for (int j = 0; j < 8; j++) { @@ -1898,6 +1900,8 @@ void Text::GlyphQuads::resizeGLObjectBuffers(unsigned int maxSize) void Text::GlyphQuads::releaseGLObjects(osg::State* state) const { _coords->releaseGLObjects(state);; + _texcoords->releaseGLObjects(state); + _colorCoords->releaseGLObjects(state); for (int j = 0; j < 8; j++) {