Hi,

When the text node's releaseGLObjects is called, it calls the same method of:
        The 
GlyphQuads
        The 
Font (which is potentially problematic when it doesn't get skipped).
        The vertex attributes (
_coords, _normals, _colorCoords, _texcoords)
        The primitives in 
_decorationPrimitives
        The base 
Drawable.

The Text destructor releases none of these, neither does the TextBase 
destructor, and the Drawable destructor doesn't release everything that its 
releaseGLObjects does, but that might be inconsequential.

The GlyphQuads should be fine as it's just its primitives that get released, 
and all the primitive sets seem to release their own stuff in their 
destructors. It should be similar for _decorationPrimitives.

The vertex attributes might be fine with the handling in their destructors, too.

As I've been saying, the font might be shared with other text nodes, so may or 
may not be released later depending on what happens with other text nodes.


That means that it's possible that within all the nested releasing of GL 
objects for a text node, only the font actually owns anything that needs 
releasing, so in the case where only one text node is removed, we get away 
without calling releaseGLObjects.

If that's the case, though, it seems like relying on it for correctness isn't a 
good strategy - surely all these release calls exist because there's some 
chance an implementation detail might change at some point and make them 
necessary.

It also isn't a great strategy to apply generally - if we removed all the text 
nodes, and didn't release the last one, the texture and program(s) the font 
owns would definitely leak. In the case of an application where for whatever 
reason it's difficult to keep track of which text node is the last, and so a 
consistent strategy is required, you're back with the release-or-leak choice.

Surely the best solution is an osgText::Text::releaseGLObjects implementation 
that's always safe to call for text nodes that won't get used again?

Cheers,
Chris

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=76357#76357





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to