View Full Version : Simple bump mapping question

09-07-2004, 12:08 AM
Sorry for the simple question (could't find good explanation in the red book).
In OpenGL RGB and Alpha values are from 0.0 to 1.0.
So what the meaning of Arg0 - Arg1 when gTexEnv is GL_SUBTRACT or any other glTexEnv param that produce 'negative' alpha/rgb values?
Arg0 - Arg1 = any number from -1.0 to 1.0, does OpenGL map it to 0.0 - 1.0 by 0.5*(Arg0 - Arg1) + 0.5?
More generally: How OpenGL represent/treat such negative values?

Tom Nuydens
09-07-2004, 12:54 AM
The values are not remapped in any way, they just get clamped. Hence, all negative values will come out as zero, and all values larger than 1.0 will come out as 1.0.

-- Tom

09-07-2004, 01:00 AM
I thought that signed arithmetic is used when using GL_DOT3_RGB, GL_ADD_SIGNED, etc. :confused:

Tom Nuydens
09-07-2004, 01:45 AM
DOT3 is a special case because it expands its inputs from [0, 1] to [-1, 1]. Outputs, however, are always in [0, 1], as are the inputs of the other texture combine functions.

-- Tom