Table of Contents Glide Programming Guide


f * (aother – alocal) + alocal º f



Download 6.22 Mb.
Page39/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   35   36   37   38   39   40   41   42   ...   106
GLIDEPGM
f * (aotheralocal) + alocal
º f * aother + (1 – f) * alocal

GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA

f * (aotheralocal) + alocal

GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL
GR_COMBINE_FUNCTION_BLEND_LOCAL

f * (– alocal) + alocal
º (1 – f) * alocal

GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA

f * (– alocal) + alocal

  1. Table Using the Alpha Component.2 Scale factors for the alpha combine function.

The second argument to grAlphaCombine(), factor, specifies a scale factor, called f in the formulas delineated in Table Using the Alpha Component.1; its value is chosen from among the symbols listed in the left hand column of the table below. The right hand column gives the scale factor that corresponds to each symbolic name. alocal and aother are defined by the third and fourth arguments to grAlphaCombine() and atexture comes from the texture combine unit, described in Chapter Chapter 9. .

Combine factor

scale factor (f)

GR_COMBINE_FACTOR_NONE

unspecified

GR_COMBINE_FACTOR_ZERO

0

GR_COMBINE_FACTOR_LOCAL

alocal / 255

GR_COMBINE_FACTOR_OTHER_ALPHA

aother / 255

GR_COMBINE_FACTOR_LOCAL_ALPHA

alocal / 255

GR_COMBINE_FACTOR_TEXTURE_ALPHA

atexture / 255

GR_COMBINE_FACTOR_ONE

1

GR_COMBINE_FACTOR_ONE_MINUS_LOCAL

1 – alocal / 255

GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA

1 – aother / 255

GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA

1 – alocal / 255

GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA

1 – atexture / 255

  1. Table Using the Alpha Component.3 Specifying local and other alpha values.

The third and fourth arguments to grAlphaCombine(), local and other, specify the sources for the alocal and aother values that appear in the alpha combine formulas delineated in Table Using the Alpha Component.1 and in the color combine formulas shown in Table Color and Lighting.1 and Table Color and Lighting.2; their values are chosen from among the symbols in the tables below. Iterated alpha values are computed by iterating the alpha specified in GrVertex structures passed to drawing functions. The texture alpha comes from the texture combine unit, and the constant alpha is set by grConstantColorValue().

Local combine source

local alpha (alocal)

GR_COMBINE_LOCAL_NONE

unspecified a

GR_COMBINE_LOCAL_ITERATED

iterated vertex a

GR_COMBINE_LOCAL_CONSTANT

constant a

GR_COMBINE_LOCAL_DEPTH

high 8 bits from iterated vertex z



other combine source

other alpha (aother)

GR_COMBINE_OTHER_NONE

unspecified a

GR_COMBINE_OTHER_ITERATED

iterated vertex a

GR_COMBINE_OTHER_TEXTURE

a from texture map

GR_COMBINE_OTHER_CONSTANT

constant a


4Alpha Buffering


As pixels are rendered, a full 32-bit RGBA color is maintained internally. At the end of the rendering pipeline, the 24-bit RGB portion is dithered to 16 bits and stored in the display buffer. The alpha value component will be discarded, unless the auxiliary buffer is being used as an alpha buffer.
With alpha buffering enabled, the Voodoo Graphics hardware stores an 8-bit alpha value for each pixel in the auxiliary buffer. To enable alpha buffering, set the alpha parameter of grColorMask() or blend using a function that calls for a destination alpha (see the following section for a discussion of alpha blending). Since the auxiliary buffer can only serve a single use at a time, depth buffering, alpha buffering, and triple buffering are mutually exclusive. If depth buffering is currently enabled (by calling grDepthMask() with argument FXTRUE), the alpha parameter specified in a grColorMask() call is ignored.
void grColorMask( FxBool rgb, FxBool alpha )

The alpha buffer is cleared by calling grBufferClear(). If alpha buffering is enabled, then the alpha buffer will be cleared using the alpha parameter. The graphics display buffer and alpha buffer can be cleared simultaneously.


void grBufferClear( GrColor_t color, GrAlpha_t alpha, FxU16 depth )

In the anti-aliasing discussion in Chapter Chapter 4. , alpha was used as a pixel coverage value for objects being rendered. Alpha blending is then used to blur the edge color with the background color and reduce unsightly “jaggies”.


The final example in this chapter, Example Using the Alpha Component.3, shows another way to use the alpha buffer. In this case, a background scene is drawn with one alpha value, a polygonal cropping window is drawn with a second alpha value, and a foreground is mapped into the cropping window by discarding parts of the new scene that fall outside the cropping window. The example uses the alpha combine unit, alpha buffering, and alpha blending.

Download 6.22 Mb.

Share with your friends:
1   ...   35   36   37   38   39   40   41   42   ...   106




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

    Main page