From Tim Daoust/Robert Osfield, added Font::releaseGLobjects(State*state=0) to

facilate clean up of scene when a graphics context is deleted/reused.
This commit is contained in:
Robert Osfield 2005-05-07 09:17:55 +00:00
parent 52e036f425
commit 08d5f9f85a
2 changed files with 14 additions and 0 deletions

View File

@ -117,6 +117,10 @@ public:
FontImplementation* getImplementation();
const FontImplementation* getImplementation() const;
/** If State is non-zero, this function releases OpenGL objects for
* the specified graphics context. Otherwise, releases OpenGL objexts
* for all graphics contexts. */
virtual void releaseGLObjects(osg::State* state=0) const;
protected:

View File

@ -202,6 +202,16 @@ Font::Glyph* Font::getGlyph(unsigned int charcode)
else return 0;
}
void Font::releaseGLObjects(osg::State* state) const
{
for(GlyphTextureList::const_iterator itr=_glyphTextureList.begin();
itr!=_glyphTextureList.end();
++itr)
{
(*itr)->releaseGLObjects(state);
}
}
osg::Vec2 Font::getKerning(unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType)
{
if (_implementation.valid()) return _implementation->getKerning(leftcharcode,rightcharcode,kerningType);