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

Robert Osfield robert.osfield at gmail.com
Wed Nov 30 07:11:41 PST 2016

Hi Alistair,

There isn't a mechanism built into the OSG to automatically provide a
way of checking and then handling texture objects not being allocated
due to out of memory issues, thankfully this isn't a common issue so
doesn't trip up most users.  The best way to catch this case would
probably be to have a graphics operation/callback that forces a
texture compile for the textures in question and then immediately
check the GL errors.

What size texture were you seeing issues with?  What is the GPU memory


On 30 November 2016 at 14:42, Alistair Baxter <alistair at mve.com> wrote:
> 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?
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list