next up previous contents
Next: Conversion to Luminance Up: 13.2.4 The Color Matrix Previous: Equivalent Functionality Without   Contents Scale and Bias

Scale and bias operations may be performed using the color matrix. A scale factor can be applied using the glScale() command. A bias is equivalent to a translation and may be applied using the glTranslate() command. Using glScale() and glTranslate(), the R scale or bias is put in the $x$ parameter, the G scale or bias in the $y$ parameter, and the B scale or bias in the $z$ parameter. Modifications to the A channel must be specified using glLoadMatrix() or glMultMatrix(). In general, using the color matrix to implement scale and bias will be slower than using a transfer operation which implements scale and bias directly, but management of state may be easier using color matrices. Also, the scale and bias could be rolled into another color matrix operation.