Win32 DirectX Fastgraph/Light


void fg_polyfill (int *vertex_array, void *unused, int n);

Sub fg_polyfill (vertex_array() As Long, unused() As Any, ByVal n As Long)

procedure fg_polyfill (var vertex_array : integer; var unused; n : integer);


The fg_polyfill() function draws a filled convex polygon in screen space, with clipping and optional backface removal. The polygon is filled with pixels of the current color. By default, pixels along the polygon's right and bottom edges are excluded to improve polygon meshing. This feature can be disabled through fg_polyedge().


vertex_array is the name of the array containing the (x,y) coordinate pairs of each vertex. The first array element is the x component of the first vertex, the second element is the y component of the first vertex, the third element is the x component of the second vertex, and so forth. If backface removal is specified, the vertices must be stored in clockwise order, meaning you would travel clockwise along the polygon edge to go from one vertex to the next when facing the front of the polygon.

unused is an unused parameter. In previous versions of Fastgraph, it was a work array used internally by fg_polyfill().

n is the number of vertices in the polygon. To specify backface removal, negate n. For example, to draw a four-vertex polygon with backface removal, set n to -4.

Return value



If you attempt to fill a non-convex polygon, only a portion of it will be filled.

If n is negative and the vertices are not stored in clockwise order, the polygon will not be drawn correctly.

See also

fg_inside(), fg_polyedge(), fg_polyline(), fg_polyoff()



Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.