Hi Frank,

On Wed, Oct 13, 2010 at 12:17 AM, Frank Sullivan
<[email protected]> wrote:
> 1) Right now, I have several objects that refer to the same texture file. Is 
> there any way to make sure that these objects, when loaded, share the same 
> texture object in memory, rather than loading the same texture multiple times?

The osgUtil::Optimizer has support for finding duplicate state, which
includes duplicate textures, you can use this to pre-process your data
prior to rendering.


> 2) It seems as though the system might use a sort of lazy loading scheme for 
> the textures. I'm not 100% sure about this, but when I first load my scene 
> and move the camera around, I notice that there is a frame rate hitch 
> whenever an object is being displayed for the first time. Once I've viewed 
> all the objects at least once, then there are no more hitches. I could be 
> wrong, but I also noticed that some of these objects have non-power-of-two 
> textures, and these hitches correspond with a console message that says 
> "Scaling image x from (800,800) to (1024,1024). So, that's why I suspect that 
> maybe the textures are being loaded when they first appear, rather than when 
> the model is loaded. If so, can this be turned off?

You can either use non power of two textures, or make sure your images
are power of two prior to loading.

In the svn/trunk version of the OSG the osg::Image::scaleImage(..)
function now can work in any thread, it no longer is restricted to
being only called from a thread with a graphics context, so it's now
possible to pre-process the imagery on load rather that during
rendering.  All you need to do is post process the loaded scene graph
rescaling any non power of two images.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to