Hi Oliver, Just case the image->data() to a GLfloat*, as long as the internal format is float you'll be just fine.
As for occlusion of the viewport you are reading from producing invalid values - this is an artifact introduced by some/many window managers, and I'm afraid there is not much you can do about it. I believe some window managers have options to ensure that the frame buffer of overlapping windows is maintained, but I'm don't recall specifics. The proper way to do reliable read back is to use an FBO or a pbuffer. Robert. On 12/13/06, Oliver Kutter <[EMAIL PROTECTED]> wrote:
Hi everybody, I want to use the osg::Image function readPixels to read back depth buffer values. But the depth buffer values are float values and I wonder how to get the float values of the image object. I set the image parameters like this. osg::Image* image = new osg::Image(); image->allocateImage(width, height, 1, GL_LUMINANCE, GL_FLOAT); Then I call readPixels to read back the depth values: image->readPixels(posx, posy, width, height, GL_DEPTH_COMPONENT, GL_FLOAT); But the function image->data() returns an unsigned char array instead of a float array. How do I get the float values of that image? Or is it even impossible to return the float data of the image? In that case, if I can't get the correct float values, I can use the OpenGL function glReadPixels instead. But then I have a problem reading back the depth values of viewports that are positioned behind the main viewport. Does anyone have a hint for me? regards, Oliver _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
