diff --git a/include/osgText/Font b/include/osgText/Font index 3d4bef4dd..6d369a52b 100644 --- a/include/osgText/Font +++ b/include/osgText/Font @@ -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: diff --git a/src/osgText/Font.cpp b/src/osgText/Font.cpp index 0914cad5c..05c468b85 100644 --- a/src/osgText/Font.cpp +++ b/src/osgText/Font.cpp @@ -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);