[osg-users] Optimizing texture power of two resizing

Chris Kuliukas chris at kuliukas.com
Tue Dec 15 18:34:32 PST 2015


We've had some troubles with stuttering when going from one screen to another, and a big part of the problem seems to be that we have textures that aren't to the power of two and need to be resized.

This resize happens right at the last minute before the data is sent to the graphics card, and it happens every time the texture needs to be reloaded.

I hacked osg/Image.cpp Image::setImage so that images are resized as they are loaded instead, but I had to set it to only resize images with a width above 50 so that it doesn't resize font textures, which causes an exception.

This does seem to be having a positive effect and working fine, but it also feels like a hack. I'm wondering how would someone who knows OSG well do this? Or if there's some other alternative I haven't thought of? 

(Resizing all the textures offline would be ideal, but would take too long given the amount of models we use and import)

Thank you!


http://www.hrwallingford.com/facilities/ship-simulation-centre (http://www.hrwallingford.com/facilities/ship-simulation-centre)

Read this topic online here:

More information about the osg-users mailing list