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

Alistair Baxter alistair at mve.com
Wed Nov 30 07:37:49 PST 2016

In the particular test case I'm looking at, it's about 5 gigs of texture and 2 gigs of video RAM. We have a manual mechanism for downsampling, but then we can end up in situations where a processed file that looks fine on a machine with 6 or 8 gigs of video ram won't load on one with far less.

Obviously, this is an absurdly profligate use of video memory, but if you've got the data, you might as well use it.

What do you mean by "have a graphics operation/callback that forces a texture compile" ? Is that sort of thing covered in the osg examples?

-----Original Message-----
From: osg-users [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert Osfield
Sent: 30 November 2016 15:12
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>
Subject: Re: [osg-users] Detecting when a texture is to big for graphics memory

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 available?


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
osg-users mailing list
osg-users at lists.openscenegraph.org

More information about the osg-users mailing list