Thank you very much, I just perfomed the change mentionned by Marcus regarding the image format (to GL_DEPTH_COMPONENT). The code was working but I was not able to visualize the data due to the missing rescale of value between z near and zfar.
I am now able to visualize the depth just by applying the resulting texture to a plane and performing the shading using pixel shaders. Thanks, Bruno Araujo Volker Settgast wrote: > Bruno Rodrigues De Araujo (IMMI INESC-ID) wrote: > >> I am trying to get access to Depth Information using FBOViewport Object >> but the data is always 0. >> Is it possible to use FBOViewport to render the Depth of a 3D scene into >> a texture to be used by a shader? >> >> > Yes, I have done that lately and it works with some luck. Your code > looks ok and more or less the same to mine. > > How do You check the result? If You set the field readBuffer to true > only the color textures are copied back to the image. But used in a > shader which reads the values You should be able to access the depth > values (that are of range 0-1 I suppose) > > I also had the problem, that debugging the depth values visually is > hard, because there may be not much difference in color between > different depths if they are far away from the camera. A bit of scaling > may help then. > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
