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

draw Subroutine

Purpose

Draws a line.

Libraries

Graphics Library

C (libgl.a)

FORTRAN (libfgl.a)

C Syntax

void draw
(Coord x, Coord y, Coord z)
void drawi
(Icoord x, Icoord y, Icoord z)
void draws
(Scoord x, Scoord y, Scoord z)
void draw2
(Coord x, Coord y)
void draw2i
(Icoord x, Icoord y)
void draw2s
(Scoord x, Scoord y)

FORTRAN Syntax

SUBROUTINE DRAW(x, y, z)
REAL x, y, z
SUBROUTINE DRAWI(x, y, z)
INTEGER*4 x, y, z
SUBROUTINE DRAWS(x, y, z)
INTEGER*2 x, y, z
SUBROUTINE DRAW2(x, y)
REAL x, y
SUBROUTINE DRAW2I(x, y)
INTEGER*4 x, y
SUBROUTINE DRAW2S(x, y)
INTEGER*2 x, y
Note: For FORTRAN users, the INTEGER*2 versions of this subroutine, DRAWS and DRAW2S, should not be called with integer constant parameters. For example, 2 is an integer constant; JJ is an integer variable. The XL FORTRAN compiler, invoked by the xlf command, stores all integer constants as long integers (INTEGER*4), not as short integers (INTEGER*2). Invoking one of the short versions of this subroutine with an integer constant will result in unexpected behavior.

Description

The draw subroutine connects the point specifies by the x, y, z parameters and the current graphics position with a line segment. It uses the current line attributes: linestyle, linewidth, color (if in depth-cue mode, the depth-cued color is used), and writemask.

The draw subroutine updates the current graphics position to the specified point.

Note: Do not place routines that invalidate the current graphics position within sequences of moves and draws.

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


2-D 3-D
Int16 draw2s draws
Int32 draw2i drawi
float draw2 draw

The syntax for each of the subroutine forms is the same except for the parameter type. They differ only in that draw expects real coordinates, drawi expects integer coordinates, and draws expects short integer coordinates. In addition, the draw2 routines assume a 2-D point instead of a 3-D point.

Parameters

x Specifies the x coordinate of the point to which to draw a line segment.
y Specifies the y coordinate of the point to which to draw a line segment.
z Specifies the z coordinate of the point to which to draw a line segment (not used by 2-D subroutines).

Example

The example C language program depthcue.c uses the drawi subroutine to draw the edges of a cube.

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

Moving the current graphics position to a specified point with the move subroutine.

Drawing a point with the pnt subroutine.

Drawing a relative line with the rdr subroutine.

Moving the current graphics position to a point relative to the current point with the rmv subroutine.

AIX Graphics Library Overview, Drawing with Move-Draw Style Subroutines, Performing Depth-Cueing in GL, Setting Drawing Attributes, and Working in Color Map and RGB Modes.


[ Previous | Next | Contents | Glossary | Home | Search ]