Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page37/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   33   34   35   36   37   38   39   40   ...   106
GLIDEPGM

5Gamma Correction


By default, Glide does not perform gamma correction (i.e. a linear ramp is used), however, gamma correction is available. A gamma value can be passed to the hardware using the Glide function grGammaCorrectionValue().
void grGammaCorrectionValue( float value )

grGammaCorrectionValue() sets the gamma correction value used during video refresh. Gamma is a positive floating point value from 0.0 to 20.0. Typical values are 1.3 to 2.2. The default value is 1.0 (i.e. a linear ramp is used).
The displayed RGB value (RGBgamma) is computed from the RGB value read from the frame buffer (RGBfb) according to the following equation:
RGBgamma = [(RGBfb/255)1/gamma]*255

Chapter 6. Using the Alpha Component

1In This Chapter


Several different rendering techniques using the alpha component of the color are discussed. You will learn about:

  • specifying alpha values

  • configuring the alpha combine unit that produces alpha values for pixels being rendered

  • using the auxiliary buffer to store alpha values

  • alpha blending, a technique for creating translucent objects in a scene

  • alpha testing, a technique for accepting or rejecting pixels based on their alpha value

2Specifying Alpha


Alpha values, like the red, green, and blue components of a color, are 8-bit values in the range [0..255]. Glide maintains a constant alpha value as part of the constant color described in the previous chapter that is set with grConstantColorValue(). Alpha values associated with vertices are set in the GrVertex structure, along with the geometric coordinates and other parameters.

3The Alpha Combine Unit


Note: Control of high level rendering functions is managed by three functions, grAlphaCombine(), grColorCombine() (see ChapterChapter 5. ), and grTexCombine() (described in Chapter Chapter 9. ). While the three routines will be presented individually, settings for one function can potentially affect the inputs to the other routines.
The alpha combine unit is similar to the color combine unit that produces RGB values for the pixel being rendered. A user-selectable combining function specifies a scale factor, and local and other alpha values, and a formula for combining them to produce a new alpha value. The alocal and aother inputs selected by the arguments to grAlphaCombine() can also be used in the scale factor chosen by grColorCombine(), described in the previous chapter.
void grAlphaCombine( GrCombineFunction_t func, GrCombineFactor_t factor,
GrCombineLocal_t local, GrCombineOther_t other,
FxBool invert

Download 6.22 Mb.

Share with your friends:
1   ...   33   34   35   36   37   38   39   40   ...   106




The database is protected by copyright ©ininet.org 2024
send message

    Main page