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

2016-12-01 Thread Robert Osfield
On 1 December 2016 at 11:55, Alistair Baxter  wrote:
> It sounded like that proxy texture mechanism was exactly what I needed, but 
> using it as described in the OpenGL red book just returned results that said 
> it was OK, when it wasn't, which is most frustrating.

In space no one can hear you scream

It sounds like the only avenue left would be to attempt to create the
texture object using Texture::apply() or possible
Texture::compileGLObjects() and check for an OpenGL error aftwards and
then provide some kind of fallback mechanism.

The other approach is break the volume data down into brick as use
multiple VolumeTile.  I haven't tried this with osgVolume yet so it
would be bleeding edge :-)

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-12-01 Thread Alistair Baxter
It sounded like that proxy texture mechanism was exactly what I needed, but 
using it as described in the OpenGL red book just returned results that said it 
was OK, when it wasn't, which is most frustrating.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-11-30 Thread werner.modenb...@texion.eu
Hi Allister,
I have a comparable situation  in my software. Displaying huge textures.
I got help from the list recently and now it works like a charm.
I split the texture in small tiles and assign them to textured quads. The quads 
are arranged to form a huge plane. The trick is arranging them in a PagedLOD 
Structure as a quad tree. Always 4 tiles create a tile of the same size in the 
next distance level with lower resolution. The tiles are loaded dynamically on 
whatever distance they appear. This way the total load of textures is not so 
high and manageable by the hardware.
Send me a private mail if you need more details. 
Werner

On 30. November 2016 15:42:17 MEZ, Alistair Baxter  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@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


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

2016-11-30 Thread Robert Osfield
Hi Alistair,

FYI, OpenGL has a texture feature called proxy textures where you can
do a trial texture allocation and then query whether that are real
texture with the same parameters will succeed. This feature isn't
utilized by the OSG so it's something you'd have to roll your own
OpenGL code to do the query.  It's probably over 15 years since I look
at this particular annex of OpenGL so there is chance that modern
drives don't support it.  It might be useful though if it's still
supported.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-11-30 Thread Robert Osfield
Hi Alistair,

On 30 November 2016 at 15:37, Alistair Baxter  wrote:
> 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.

This is where paging coming in handy.  We have ready made solution for
2d imagery and terrain but alas not one for volume rendering yet.

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

There a number of ways to go about it, one is add a draw callback to
the view's camera, or use a draw callback on a drawable in the scene
graph.  The other way would be to use RealizeOperation as the
osgvolume example uses to check for max support texture sizes.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-11-30 Thread Alistair Baxter
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-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: 30 November 2016 15:12
To: OpenSceneGraph Users 
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?

Robert.

On 30 November 2016 at 14:42, Alistair Baxter  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@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
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2016-11-30 Thread Alistair Baxter
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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org