Table of Contents Glide Programming Guide



Download 6.22 Mb.
Page30/106
Date03.02.2023
Size6.22 Mb.
#60547
1   ...   26   27   28   29   30   31   32   33   ...   106
GLIDEPGM
grAADrawPoint() renders the point as four pixels, each blended according to the computed pixel coverage.
Lines drawn with grAADrawLine() will be somewhat “fatter” than expected.
grAADrawTriangle() has three more arguments than its aliased counterpart grDrawTriangle(). The arguments, aaAB, aaBC, and aaBC are Boolean values that allow the edges of the triangle to be selectively anti-aliased.
grAADrawPolygon() and grAADrawPolygonVertexList() draw convex polygons with anti-aliased edges.
guAADrawTriangleWithClip() performs 2D clipping on the specified triangle, and draws the resultant polygon with grAADrawPolygonVertexList(). All edges of the clipped triangle will be anti-aliased.
Example Rendering Primitives.2 Drawing an anti-aliased triangle.
The alpha combine unit must be configured to produce an iterated alpha value in order to use the Glide anti-aliasing drawing functions. Consider the following code segment a recipe for success in this chapter; the alpha combine unit, alpha buffering, and alpha blending are the subject of Chapter Chapter 6. .
The objects in the picture must be pre-sorted on depth. The alpha blending factors depend on whether the scene is drawn from front to back or back to front. The first code shows the alpha blending factors if the scene is drawn from front to back.
/* set alpha combine unit to produce an iterated alpha */
grAlphaCombine(GR_COMBINE_SCALE_OTHER, GR_COMBINE_FACTOR_ONE, GR_LOCAL_NONE, GR_LOCAL_INTERATED, FXFALSE);

/* blend colors based on alpha */


grAlphaBlendFunction(GR_BLEND_ ALPHA_SATURATE, GR_BLEND_ONE, GR_BLEND_ SATURATE, GR_BLEND_ONE);

/* draw the scene using the grAADraw routines */


Substitute the alpha blending factors shown below if the scene is drawn from back to front.
GrAlphaBlendFunction(GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA, GR_BLEND_ZERO, GR_BLEND_ZERO);


Download 6.22 Mb.

Share with your friends:
1   ...   26   27   28   29   30   31   32   33   ...   106




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

    Main page