Writing a Graphics Program
Like many programs, graphics programs work well when written in small units. Using discrete routines aids debugging by isolating the functional components of the program. The following example program and its associated subroutines show the steps involved in initializing, drawing, and closing a graphics program.
The SINE program draws a sine wave. Its procedures call many of the common graphics routines. The main program calls five subroutines that carry out the actual graphics commands (also located in the SINE.F90 file):
! SINE.F90 - Illustrates basic graphics commands. ! USE IFQWIN CALL graphicsmode( ) CALL drawlines( ) CALL sinewave( ) CALL drawshapes( ) END . . .
For information on the subroutines used in the SINE program, see:
graphicsmode in section Activating a Graphics Mode
drawlines in section Drawing Lines on the Screen
sinewave in section Drawing a Sine Curve
drawshapes in section Adding Shapes
The SINE program's output appears in the following figure. The project is built as a Fortran Standard Graphics application.
Did you find the information on this page useful?