Fixes to osgText to improve robustness when running multithreaded multipipe

apps.
This commit is contained in:
Robert Osfield 2002-03-01 09:28:47 +00:00
parent 0439b72da7
commit 084ca39841
2 changed files with 15 additions and 6 deletions

View File

@ -3,12 +3,15 @@
#include "FTGlyphContainer.h"
#include "FTGL.h"
#include <osg/DisplaySettings>
// 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];

View File

@ -2,6 +2,8 @@
#include "FTGlyphContainer.h"
#include "FTTextureGlyph.h"
#include <osg/DisplaySettings>
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)