Graphics library examples

Lee A. Butler butler at BRL.MIL
Fri Mar 9 11:54:43 AEST 1990


This evening I sat down at the IRIS to start learning to use the graphics
library. On page 1-5 of the "Graphics Library Programming Guide" is the
program "red.c" which I typed in verbatim:

#include <gl/gl.h>

main()
{
        prefposition(100, 500, 200, 600);
        shademodel(FLAT);
        winopen("red");
        color(RED);
        clear();
        sleep(5);
}

then I compiled with the command line in the manual:

% cc red.c -lgl -o red

And tried to run the result:

% red
Segmentation fault (core dumped)
% dbx red
dbx version 1.31 1/22/90 2:02
Copyright 1987 Silicon Graphics Inc.
Copyright 1987 MIPS Computer Systems Inc.
Type 'help' for help.
Reading symbolic information of `red' . . .
Process name from core dump: red
Process died at pc 0x400774 of signal : segmentation violation
[using memory image in core]
(dbx) where
>  0 shademodel(0x64, 0x1f4, 0xc8, 0x258, 0x0, 0x400214) [0x400770]
   1 main() ["red.c":7, 0x400260]
(dbx) q


I noticed that if you leave out the call to "shademodel" the program works
as advertised.

Lee A. Butler
SLCBR-VL-V					Internet: butler at brl.mil
Ballistic Research Laboratory			   Phone: (301) 278-8740
Aberdeen Proving Grounds, MD 21005-5066



More information about the Comp.sys.sgi mailing list