Added Text::GlyphQuads::release/resizeGLObjects() and handling of inconsistent contextID sizes to avoid crashes when viewers and scene graphs aren't initialized correctly to the right number of contexts.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14946 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-07-13 16:09:40 +00:00
parent d221133728
commit 222871aade
2 changed files with 84 additions and 2 deletions

View File

@@ -317,11 +317,13 @@ public:
void updateQuadIndices();
GlyphQuads();
GlyphQuads(const GlyphQuads& gq);
void initGlyphQuads();
void initGPUBufferObjects();
Glyphs getGlyphs() { return _glyphs; }
const Glyphs getGlyphs() const { return _glyphs; }
Glyphs& getGlyphs() { return _glyphs; }
const Glyphs& getGlyphs() const { return _glyphs; }
Coords2& getCoords() { return _coords; }
const Coords2& getCoords() const { return _coords; }
@@ -334,6 +336,18 @@ public:
LineNumbers& getLineNumbers() { return _lineNumbers; }
const LineNumbers& getLineNumbers() const { return _lineNumbers; }
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);
/** 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;
private:
GlyphQuads& operator = (const GlyphQuads&) { return *this; }
};
typedef std::map<osg::ref_ptr<GlyphTexture>,GlyphQuads> TextureGlyphQuadMap;