<div dir="ltr"><div><div><div>Hi Chris,<br><br></div>On modern graphics cards you can change the osg::Texture ResizeNonPowerOfTwoHint setting so that non power of two textures are passed to the GL driver without resizing. From the include/osg/Texture header:<br><br> /** Sets whether to force the texture to resize images that have dimensions<br> * that are not a power of two. If enabled, NPOT images will be resized,<br> * whether or not NPOT textures are supported by the hardware. If disabled,<br> * NPOT images will not be resized if supported by hardware. */<br> inline void setResizeNonPowerOfTwoHint(bool flag) { _resizeNonPowerOfTwoHint = flag; }<br><br><br></div>Another alternative is to simply pre-process the osg::Image by rescaling them with a custom visitor that is applied to a newly loaded subgraph that does the reszie - there should be no need to hack osg::Image to this. <br><br></div>Robert.<br><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 16 December 2015 at 02:34, Chris Kuliukas <span dir="ltr"><<a href="mailto:chris@kuliukas.com" target="_blank">chris@kuliukas.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
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.<br>
<br>
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.<br>
<br>
<br>
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.<br>
<br>
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?<br>
<br>
(Resizing all the textures offline would be ideal, but would take too long given the amount of models we use and import)<br>
<br>
<br>
Thank you!<br>
<br>
Cheers,<br>
Chris<br>
<br>
------------------------<br>
<a href="http://www.hrwallingford.com/facilities/ship-simulation-centre" rel="noreferrer" target="_blank">http://www.hrwallingford.com/facilities/ship-simulation-centre</a> (<a href="http://www.hrwallingford.com/facilities/ship-simulation-centre" rel="noreferrer" target="_blank">http://www.hrwallingford.com/facilities/ship-simulation-centre</a>)<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=65877#65877" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=65877#65877</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>