Re: [osg-users] Textures problems in FLTK Viewer utility with LOD model and Viewer.

2010-08-25 Thread Dario Minieri
Hi Ulrich.

I save the osg format and the Texture2D record is inserted correctly but the 
file path disappears (I load objects that already have the textures, I don't 
apply the textures in my tool).

I'm going to try to use setUnRefImageDataAfterApply before using setSceneData. 
I'll tell you if it works, meanwhile thanks :D

Best regards

Dario


Ulrich Hertlein wrote:
 
 Are you saving '.ive' files with inlined textures by any chance?
 
 Once a texture is applied/used its associated image data by default is 
 removed from memory
 to save space.  This means that the image *data* cannot be saved to disk 
 anymore (but the
 file name can).
 
 You can prevent this by calling 'setUnRefImageDataAfterApply(false)' on the 
 textures.
 


--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31031#31031





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


Re: [osg-users] Textures problems in FLTK Viewer utility with LOD model and Viewer.

2010-08-25 Thread Dario Minieri
Hi,
Hi Ulrich.

Yes, I've made a Visitor to setUnRefImageDataAfterApply(false) for all textures 
properties and now works like charm.

Thank you!

Cheers,
Dario

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31050#31050





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


Re: [osg-users] Textures problems in FLTK Viewer utility with LOD model and Viewer.

2010-08-25 Thread Jean-Sébastien Guay

Hello Dario,


Yes, I've made a Visitor to setUnRefImageDataAfterApply(false) for all textures 
properties and now works like charm.


If you want to have less code to maintain, you could just use the 
osgUtil::Optimizer::TextureVisitor like this:


osgUtil::Optimizer::TextureVisitor visitor(true, false, false, false, 
false, 0.0);


(check the names of the arguments in the header to see what they mean... 
But it works well, we've used it before)


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Textures problems in FLTK Viewer utility with LOD model and Viewer.

2010-08-25 Thread Ulrich Hertlein
Hi Dario,

On 25/08/10 19:08 , Dario Minieri wrote:
 I save the osg format and the Texture2D record is inserted correctly but the 
 file
 path disappears (I load objects that already have the textures, I don't apply 
 the
 textures in my tool).

My bad - it's not only the image data that's released/unref'd but the entire 
osg::Image,
so the file name is no longer available as well.

Good to hear it's working for you.

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


[osg-users] Textures problems in FLTK Viewer utility with LOD model and Viewer.

2010-08-24 Thread Dario Minieri
Hi,

I have a very strange problem. I've written an FLTK application, which use the 
viewer (pretty similar to the FLTKViewer in the OSG examples), that compose and 
show LOD models. I can load multiples models and I inserted these models as 
childs of an osg::LOD node. Then, I've tried to write the LOD model into a file 
using writeObject method and ref_ptr original LOD pointer as first parameter. 

Now, I've a strange behaviour. In the viewer ALL WORKS FINE, I can see the 
models switch and all relatives textures correctly. The written LOD model is 
correct in terms of meshes (I see the correct models transition when the bound 
is reached) but there is a very strange problem with the textures (assuming to 
use 2 models):

1. If I DON'T switch between near and middle object in the viewer, then the LOD 
model written have NO TEXTURE for the NEAR object, but have the CORRECT texture 
for the second model!

2. If I SWITCH between near and middle object in the viewer, then I see NO 
TEXTURE for all LOD objects models.

I've tried to disable the my_viewer-setSceneData(LOD_model_pointer) (and the 
Fl::redraw() idle action), so that I can't view the models loaded in the 
viewer. In this case, the LOD written model is correct!!! There are all 
textures!!! I've tried also writing the LOD model without using the graphical 
application (this is rougly the same test...) and, obviously, all works fine!!!

So, seems that if an object is visualized under the viewer, then the 
writeObject method don't writes the textures informations, otherwise is ok. In 
effects, the near model is ever showed as first and so don't ever has the 
textures. The viewer locks the texture informations...?!? This is very 
strange for me...

Can you help me?

Many thanks!

Thank you!

Cheers,
Dario

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=31019#31019





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


Re: [osg-users] Textures problems in FLTK Viewer utility with LOD model and Viewer.

2010-08-24 Thread Ulrich Hertlein
Hi Dario,

On 25/08/10 4:26 , Dario Minieri wrote:
 Now, I've a strange behaviour. In the viewer ALL WORKS FINE, I can see the 
 models
 switch and all relatives textures correctly. The written LOD model is correct 
 in terms
 of meshes (I see the correct models transition when the bound is reached) but 
 there is
 a very strange problem with the textures (assuming to use 2 models):
 
 1. If I DON'T switch between near and middle object in the viewer, then the 
 LOD model
 written have NO TEXTURE for the NEAR object, but have the CORRECT texture for 
 the
 second model!
 
 2. If I SWITCH between near and middle object in the viewer, then I see NO 
 TEXTURE for
 all LOD objects models.
 
 I've tried to disable the my_viewer-setSceneData(LOD_model_pointer) (and the
 Fl::redraw() idle action), so that I can't view the models loaded in the 
 viewer. In
 this case, the LOD written model is correct!!! There are all textures!!! I've 
 tried
 also writing the LOD model without using the graphical application (this is 
 rougly the
 same test...) and, obviously, all works fine!!!
 
 So, seems that if an object is visualized under the viewer, then the 
 writeObject method
 don't writes the textures informations, otherwise is ok. In effects, the near 
 model is
 ever showed as first and so don't ever has the textures. The viewer locks 
 the texture
 informations...?!? This is very strange for me...

Are you saving '.ive' files with inlined textures by any chance?

Once a texture is applied/used its associated image data by default is removed 
from memory
to save space.  This means that the image *data* cannot be saved to disk 
anymore (but the
file name can).

You can prevent this by calling 'setUnRefImageDataAfterApply(false)' on the 
textures.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org