PDA

View Full Version : strange glReadPixels results!



graphicsMan
05-01-2003, 09:38 PM
Hi all -

I'm getting strange readback values while using Mark Harris' PBuffer class. I'm using floating point pbuffers.

Here's what I do:

1)SetCapture on the pbuffer class
2)Clear
3)Using Cg and rendering to a quad, I render a color equal to texcoord / DIMENSIONS (to give values between 0 and 1)
4)glReadPixels on the buffer
5)EndCapture the pbuffer
5)splat the texture back onto the quad

All steps other than (4) are working. I see a nice ramp of black to red on one edge, black to green on the other edge, and black to yellow on the diagonal. This is just as expected.

The values in (4) are clearly wrong, however. The values I get out should be something like:
0 0 0 1
0.001 0 0 1
0.002 0 0 1...

What I actually get is something like:
0 0 0 1
0.5 0 0 1
1.0 0 0 1
1.5 0 0 1...

the values are a few orders of magnitude too high. The values should be interpolated in the range [0,1024], and then in my shader, divided by 1024, to get a color range [0,1]. I can tell this works, because the image that gets splatted to the screen is correct.

Has anyone seen this before, or can anyone postulate on a fix for this?

Thanks,
Brian




[This message has been edited by graphicsMan (edited 05-01-2003).]

graphicsMan
05-01-2003, 10:02 PM
Please disregard the question... I am a dolt. Too little sleep perhaps?