Hi Thomas,

There isn't presently a mechanism for throwing an OSG exception or
calling a callback when GL errors happen.  By default the OSG checks
for GL Errors every frame and reports these to the console.  You can
however, write your own camera post draw callback, or drawable draw
callback to check for GL errors.

However, trying to fix a problem after you've already run out of
memory is trying to close the barn door after the horse has already
bolted.  What you should be looking at is ways of better load
balancing so that the GL memory is never exhausted.  The latest dev
and sev/trunk version or the OSG has support for GL buffer objects
pools that you can assign limits to, when enabled the object pool will
expand till it's full and then restart automatically reusing GL
objects to prevent the usage going above the user defined limit.

Have a look at OSG_TEXTURE_POOL_SIZE env var for setting the maximum
size in bytes of the pool, setting it to 0 disable it.  Also can set
it via osg::State::setMaxTexturePoolSize(uint);

Robert.

On Tue, Nov 2, 2010 at 2:14 PM, Tomas Hnilica <tomas.hnil...@webstep.net> wrote:
> Hi,
>
> What is the best way to catch openGL errors?
>
> My scenegraph uses osg::PagedLOD nodes and in some cases it happens that GPU 
> goes out-of-memory and I can see this message on std::cout.
> I would like to catch this error and adjust PagedLOD settings to have less 
> nodes in the scene.
>
> My idea is to catch the error, change the osg::PagedLOD::setRange and clear 
> the scene to free currently used GPU memory. How can I catch the error and 
> free occupied memory?
>
> Can the openGL error be catched by subclassed osg::Drawable::DrawCallback to 
> all drawables ?
>
> Thank you!
>
> Tomas
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=33314#33314
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to