From 1cd0a5fe03c1cf07a5a5a5a45464ba2c2ebb03cd Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 24 Oct 2017 11:36:00 +0100 Subject: [PATCH] Fixed Glyph::TextureInfo assignment bug --- include/osgText/Glyph | 11 ++--------- src/osgText/Font.cpp | 4 ++-- src/osgText/Glyph.cpp | 20 +++++++++++++++++++- src/osgText/Text.cpp | 1 - 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/include/osgText/Glyph b/include/osgText/Glyph index 125cf7476..2d1eafa05 100644 --- a/include/osgText/Glyph +++ b/include/osgText/Glyph @@ -100,16 +100,9 @@ public: float texelMargin; }; - void setTextureInfo(ShaderTechnique technique, TextureInfo* info) - { - if (technique>=_textureInfoList.size()) _textureInfoList.resize(technique+1); - _textureInfoList[technique] = info; - } + void setTextureInfo(ShaderTechnique technique, TextureInfo* info); - const TextureInfo* getTextureInfo(ShaderTechnique technique) const - { - return (technique<_textureInfoList.size()) ? _textureInfoList[technique].get() : 0; - } + const TextureInfo* getTextureInfo(ShaderTechnique technique) const; TextureInfo* getOrCreateTextureInfo(ShaderTechnique technique); diff --git a/src/osgText/Font.cpp b/src/osgText/Font.cpp index 7d6c61c1f..599dd6f6e 100644 --- a/src/osgText/Font.cpp +++ b/src/osgText/Font.cpp @@ -456,12 +456,12 @@ void Font::assignGlyphToGlyphTexture(Glyph* glyph, ShaderTechnique shaderTechniq itr!=_glyphTextureList.end() && !glyphTexture; ++itr) { - if ((*itr)->getSpaceForGlyph(glyph,posX,posY)) glyphTexture = itr->get(); + if ((*itr)->getShaderTechnique()==shaderTechnique && (*itr)->getSpaceForGlyph(glyph,posX,posY)) glyphTexture = itr->get(); } if (glyphTexture) { - //cout << " found space for texture "<