[osg-users] How to completely clear OSG/OpenGL? Looking for OSG/OpenGL monitor

Robert Osfield robert.osfield at gmail.com
Wed Sep 19 01:38:44 PDT 2007


On 9/19/07, Raymond de Vries <reedev at xs4all.nl> wrote:
> Hi everyone,
>
> I am triggered by the discussion about releasing and flushing GL
> Objects. In my application I am frequently loading and removing osg
> nodes in the assumption that the associated OpenGL objects are deleted
> too. Reading the discussion, and setting breakpoints in
> releaseGLObjects, it seems indeed that these objects are not deleted.

releaseGLObjects can't delete the OpenGL objects as it won't have the
contexts current to do it - all it can do is place the OpenGL objects
in a queue ready for deletion by the appropriate threads.

> I guess I need to clear the OpenGL objects myself. Isn't there an option
> or so to do this automatically?

The viewer does a flush for a small time segment on each frame.  For
most apps this will steadily clean things up for you.  Alternatively
one can call osg::flushAllDeletedGLObjects(unsigned int contextID)
manually but you'll need to do this from the appropriate graphics
thread.


> In the same context, I have another question. Is there functionality in
> OSG to check the OpenGL resources? Before loading a model, e.g. from
> file, I would like to have an indication whether or not this is possible
> or not. Or else, when a model is loaded, how do I see if all the OpenGL
> objects can be created without OpenGL going to swap previous resources?

OpenGL doesn't provide any measure of how much memory is used on the
GPU and how much is left.  The OSG as consequence doesn't know this
either.

Robert.



More information about the osg-users mailing list