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/

Reply via email to