Hello Geraud,

I have a scene with an osg::Box, and I'd like to obtain a "raster" 
representation of my scene like this:
[...]
I was thinking using LineSegments to find out the intersections with the 
geometry object of the scene.
And the result will probably be:
[...]
My problem is how I could fill the cells that are inside of the box?

Why would you think you would get an empty box? The box has 6 faces, so it's closed, and thus the intersector should find intersections over the whole face that's facing the camera (where the rays are being shot from). But:

I am new in OSG, and I am not sure I am using the correct approach, and I could'nt find 
anything about "Vector to Raster" in osg.

I would do this as a Render-to-Texture (RTT) pass. Just set up your camera in ortho mode (I think that's what you're looking for, as opposed to perspective) and set it up to render to texture and attach an osg::Image of the appropriate dimensions to it. After the next frame the image will represent your object rasterized. This better utilizes the graphics hardware, as line segment intersections all happen on the CPU.

Then if all you want is to know if the object is present or not in a given pixel you can reduce the bit depth of the texture target (you would just need one bit but that's not an option, the lowest bit depth you can use is GL_LUMINANCE which is 8 bits).

Many OSG examples demonstrate RTT, have a look through their code to see examples of this.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [email protected]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to