View Full Version : glDrawPixels with GL_FLOAT data

08-05-2004, 01:10 PM
Is there a defined behaviour for using floating poin t data with glDrawPixels, where some of the values fall outside of the range [0.0, 1.0]?

Should it automatically clamp the values to this range, should it just overflow and (effectively) wrap around, or is it undefined what the behaviour should be?

On a similar point, what is the behaviour for the same data when using as the source for glTexImage2D? Again, should it wrap, clamp or is it undefined?

08-05-2004, 04:35 PM
Values outside the range [0, 1] are clamped. Check the diagram on page 103 in the latest specification for the operation of pixel values transfered to OpenGL.

08-05-2004, 05:47 PM
I seem to recall that the spec states that floating-point values are not clamped.

08-05-2004, 09:55 PM
Originally posted by Korval:
I seem to recall that the spec states that floating-point values are not clamped.... if the destination buffer is a floating point buffer. Color buffers with integer representations always clamp irrespectively of the glDrawPixels input format.

08-06-2004, 04:09 AM
In that case, then it looks like a buggy Mac OS X implementation...

The behaviour I get on Linux is that the values are clamped. So, an image which is just a linear gradient from left to right, with values -1.0 on the left and 2.0 on the right gives an output which is black for the left third, white on the right third, and a greyscale ramp in the middle third.

On OSX, I seem to get the unclamped behaviour so the left third and right third are exactly the same as the central third (e.g. a greyscale ramp).