diff --git a/src/osgText/FTFont.cpp b/src/osgText/FTFont.cpp index 782005e86..671b96f1f 100644 --- a/src/osgText/FTFont.cpp +++ b/src/osgText/FTFont.cpp @@ -3,12 +3,15 @@ #include "FTGlyphContainer.h" #include "FTGL.h" +#include // mrn@changes FTFont::FTFont() : numFaces(0), err(0) { + _contextGlyphList.resize(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),NULL); + pen.x = 0; pen.y = 0; } @@ -52,8 +55,8 @@ bool FTFont::FaceSize( const unsigned int size, const unsigned int res , unsigne charSize = face.Size( size, res); // check the context - while (_contextGlyphList.size() <= renderContext) - _contextGlyphList.push_back(NULL); + if (_contextGlyphList.size() <= renderContext) + _contextGlyphList.resize(renderContext,NULL); FTGlyphContainer*& glyphList=_contextGlyphList[renderContext]; diff --git a/src/osgText/FTGLTextureFont.cpp b/src/osgText/FTGLTextureFont.cpp index 7ec8f20e0..9f8ae8319 100644 --- a/src/osgText/FTGLTextureFont.cpp +++ b/src/osgText/FTGLTextureFont.cpp @@ -2,6 +2,8 @@ #include "FTGlyphContainer.h" #include "FTTextureGlyph.h" +#include + inline GLuint NextPowerOf2( GLuint in) { in -= 1; @@ -25,7 +27,9 @@ FTGLTextureFont::FTGLTextureFont() glyphHeight(0), glyphWidth(0), padding(1) -{} +{ + glContextTextureID.resize(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),0); +} FTGLTextureFont::FTGLTextureFont(int textureSize) : maxTextSize(textureSize), @@ -36,7 +40,9 @@ FTGLTextureFont::FTGLTextureFont(int textureSize) glyphHeight(0), glyphWidth(0), padding(1) -{} +{ + glContextTextureID.resize(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),0); +} FTGLTextureFont::~FTGLTextureFont() { @@ -55,8 +61,8 @@ bool FTGLTextureFont::MakeGlyphList(unsigned int renderContext) // FTGlyphContainer* glyphList=_contextGlyphList[renderContext]; // check the context - while (glContextTextureID.size() <= renderContext) - glContextTextureID.push_back(NULL); + if (glContextTextureID.size() <= renderContext) + glContextTextureID.resize(renderContext,0); unsigned long* glTextureID=glContextTextureID[renderContext]; if(glTextureID)