OK, forget about this issue of non-used 3D textures guys ! This was due to a stupid mistake:
I was assigning a sampler with a not yet rendered image! Manu. 2010/8/6 Emmanuel Roche <roche.emman...@gmail.com> > Hi guys ! > > The solution I suggested to myself, actually works ! > > So, if someone needs to render to a 3D image one day, one available option > is to attach slices of the target images as mentioned below. > > To get those slices I used some code like (where z is the slice to render > to) > > *osg::Image* SceneTools::get3DImageSlice(osg::Image * src, int z) > { > // Create a new image: > osg::Image* img = new osg::Image(); > int ww = src->s(); > int hh = src->t(); > unsigned char* data = src->data(0,0,z); > img->setImage (ww, hh, 1, src->getInternalTextureFormat(), > src->getPixelFormat(), src->getDataType(), data, osg::Image::NO_DELETE, > src->getPacking()); > > return img; > }* > > > Now I have another issue related to those 3D texture/images usage: > > I'm trying to copy a 3D Texture/image into another 3D texture/image with > GLSL. And for a reason I cannot explain this is just not working... :-( > > I have the following setup: > > > - created a target 3D image to hold the copy result. > - create multiple cameras, with multiple color attachment (one camera > for slice of the target image), each camera has the proper "slice" uniform > interger. > - Assigned the source 3D image as a SAMPLER_3D uniform on a parent > group for all the cameras. > - Applied a shader on the parent group for all the cameras to just copy > the source image slice into the target image slice... > > > ==> Is there something I could be missing here ? > > Just let me know if you need some code to have a better idea of what I'm > doing (but almost everything is written in Lua). > > > ==> One very strange thing about this is: if I use a 2D source image > instead of a 3D source image, everything works just fine ! [I can for > instance use the slice index to fade the input 2D image, and thus get a > valid resulting 3D image with different slices]. > > > Any help would really be appreciated here :-) > > Cheers! > > Manu. > > > 2010/8/4 Emmanuel Roche <roche.emman...@gmail.com> > >> Concerning this problem, I'm wondering if I could use the following >> solution: >> >> 1. Create a "master" 3D image, and allocate it; >> 2. Since attaching 2D images to a camera would not require any face >> argument, I could create "sub" images, one per z slice of the master camera, >> and use setImage with an offset data pointer in the master image data... >> 3. Then assign those sub images to each camera I'm using to render the >> complete 3D image. >> >> Would this work as expected ?? Or would attaching an image to a camera >> actually somehow reallocate the image data ??? (and thus we would not be >> able to write the slice data into the master image data). >> >> I hope, those explanations are clear enough :-) >> >> Manu. >> >> >> 2010/8/4 Emmanuel Roche <roche.emman...@gmail.com> >> >> Hi everyone, >>> >>> I'm currently trying to generate some 3D images in an OSG based app. >>> >>> I've read the previous discussions on the OSG forums concerning the 3D >>> texture rendering, but this doesn't help in my situation. What I really need >>> is *3D image* rendering not *3D texture* rendering. >>> >>> More explanations: >>> >>> * One can attach an osg::Image or an osg::Texture to the color buffer of >>> a given camera. But one can only specify the "face" argument for textures: >>> >>> *void attach <http://a00098.html#a496ed6d69392c1fdb8548085900a1a87> ( >>> BufferComponent >>> <http://a00098.html#af4d8ae808500a2f5bc9fe7b605386e74>buffer, >>> osg::Texture <http://a00946.html> *texture, unsigned int level=0, >>> unsigned int face=0, bool mipMapGeneration=false, unsigned int >>> multisampleSamples=0, unsigned int multisampleColorSamples=0) >>> >>> void attach <http://a00098.html#a4124951a5032de595c5d28d0cc5e87a3> ( >>> BufferComponent >>> <http://a00098.html#af4d8ae808500a2f5bc9fe7b605386e74>buffer, >>> osg::Image <http://a00389.html> *image, unsigned int >>> multisampleSamples=0, unsigned int multisampleColorSamples=0) >>> >>> ** So, >>> - if I attach a 3D image directly to the camera, the depth of the image >>> is not taken into account, and all the image "slices" will contain the same >>> result. >>> - if I attach a Texture3D object, whether I assign it an underlying >>> image doesn't matter: the content of the "texture" cannot be retrieved with >>> the assigned image... >>> >>> Is there something I'm missing here ? Did someone already successfully >>> render to a 3D texture *AND* wrote that texture to a file for instance >>> ?? >>> >>> Or is there a way to retrieve the content of a 3D texture into a 3D image >>> (I guess retrieving the texture data from the graphic card somehow ?) [I'm >>> not very good at pure OpenGL considerations, thus the question :-) ]. >>> >>> Cheers! Thanks for your help guys! >>> >>> Manu. >>> >>> >> >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org