[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
GL3.2 for AIX: Graphics Library (GL) Technical Reference

## poly Subroutine

Draws a polygon.

### Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

### C Syntax

`void poly(Int32 n, Coord parray[ ])`
`void polyi(Int32 n, Icoord parray[ ])`
`void polys(Int32 n, Scoord parray[ ])`
`void poly2(Int32 n, Coord parray[ ])`
`void poly2i(Int32 n, Icoord parray[ ])`
`void poly2s(Int32 n, Scoord parray[ ])`

### FORTRAN Syntax

```SUBROUTINE POLY(n, parray)
INTEGER*4 n
REAL parray(3,n)```
```SUBROUTINE POLYI(n, parray)
INTEGER*4 n
INTEGER*4 parray(3,n)```
```SUBROUTINE POLYS(n, parray)
INTEGER*4 n
INTEGER*2 parray(3,n)```
```SUBROUTINE POLY2(n, parray)
INTEGER*4 n
REAL parray(2,n)```
```SUBROUTINE POLY2I(n, parray)
INTEGER*4 n
INTEGER*4 parray(2,n)```
```SUBROUTINE POLY2S(n, parray)
INTEGER*4 n
INTEGER*2 parray(2,n)```

### Description

The poly subroutine draws polygons using the current line attributes: linestyle, linewidth, color, and writemask. Polygons are represented as arrays of points. The first and last points automatically connect to close a polygon.

Polygons in 2-D are drawn with z = 0.

The six different forms for the poly subroutine are as follows:

 2-D 3-D Int16 poly2s polys Int32 poly2i polyi float poly2 poly

The syntax for each of the subroutine forms is the same except for the first argument. They differ only in that poly expects real coordinates, polyi expects integer coordinates, and polys expects short integer coordinates. In addition, the poly2 routines assume a 2-D point instead of a 3-D point.

There can be no more than 256 vertices in a polygon.

### Parameters

 n Specifies the number of points in the polygon. parray Specifies an array containing the vertices of the polygon.

### Example

The example C language program tpbig.c uses the poly2i subroutine to outline an ice cream cone in black.

### Implementation Specifics

This subroutine is part of GL in the AIXwindows Environment/6000 Version 1, Release 2 with AIXwindows/3D Feature.

### Files

 /usr/include/gl/gl.h Contains C language constant and variable type definitions for GL. /usr/include/gl/fgl.h Contains FORTRAN constant and variable type definitions for GL.

### Related Information

Allowing the system to draw concave polygons with the concave subroutine.

Specifying the next point in a polygon with the pdr subroutine.

Specifying the starting point for a polygon with the pmv subroutine.

Drawing a filled polygon with the polf subroutine.

Drawing a rectangle with the rect subroutine.

Drawing a filled rectangle with the rectf subroutine.

Drawing a relative polygon with the rpdr subroutine.

Moving the current graphics position to a starting point for a filled polygon relative to the current point with the rpmv subroutine.

AIX Graphics Library Overview, Setting Drawing Attributes, and Drawing Rectangles, Circles, Arcs, and Polygons.

[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]