[osg-users] Detecting when a texture is to big for graphics memory

Alistair Baxter alistair at mve.com
Wed Nov 30 06:42:17 PST 2016

Our application is using osgVolume to render 3D texture data that is provided by users. This means the data can be very large, and can exceed the amount of available graphics memory on some machines.

I was looking for a way to detect whether a texture has failed to load in this way, so that we can alert the user, or react to the problem in some other way. But I'm having trouble finding anything in code that will help.
OpenSceneGraph responds with   "Warning: detected OpenGL error 'out of memory' at after RenderBin::draw(..)"   but I'm not seeing anything in the scene graph data that can indicate that the texture in question is at fault. The TextureObject representing the 3D texture, for example declares that it is allocated, and reports the correct size and a positive id.

Is there any way to tell whether a texture is too big for graphics memory, other than by just knowing how much there is in total  (a feature that only seems to work for me on NVidia hardware anyway) and checking whether the known size of your texture will fit?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161130/abbee3f6/attachment-0002.htm>

More information about the osg-users mailing list