On 6/11/2011 8:14 AM, Chris 'Xenon' Hanson wrote:
Also, is there a limit to the amount of textures I could load into GPU.   I 
tried loading 25 4096by4096 textures and it crashes when I tried to load more.  
Is there any ways to increase the amount that I could load?

   It's just limited by memory. What are your 25 textures? Usually one doesn't 
need 25 4k
textures unless you're doing volumetric work or something.

Chris is right. For uncompressed rgba (four byte per texel) data, a 4kx4k texture consumes 4k * 4k * 4bytes = 64MB. Times 25 textures = 1.6GB. If this is a 32-bit app, chances are it's your application that is exhausting per-process host RAM and crashing, rather than a GPU RAM / OpenGL issue, but you'd have to check the call stack. You might try your app on a 64-bit system.

But, using that many textures will likely cause OpenGL to swap textures in and out of GPU RAM, which will kill performance, so you should look at using fewer/smaller textures or using a compressed texture format.

You can set OSG_MAX_TEXTURE_SIZE in your environment to restrict the maximum size of texture objects that OSG creates. For example:
  OSG_MAX_TEXTURE_SIZE=1024
means if the texture you load from disk is larger than 1kx1k, OSG will reduce it to 1kx1k before sending it to the GPU. This can be a handy tool for digging in to texture memory or performance issues.

--
  -Paul Martz      Skew Matrix Software
                   http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to