Programming and Graphics

(Kiana) #1

282 Introduction to C++ Programming and Graphics


Figure 8.3.1 A drop-down menu generated by GLUT. Clicking on an option changes
the display.

Gluiis aGlut-based user interface library providing buttons, check-
boxes, radio buttons, spinners, and other controls to OpenGL applications (see:
http://glui.sourceforge.net)..) The calls are window-system independent,
relying onGlutto handle all system-dependent processes such as window and
mouse management. TheGluidistribution includes an informative user man-
ual accompanied by a tutorial.


The library can be compiled readily using the makefile provided in the
distribution to produce the library archivelubglui.a. We will assume that this
file has been copied into the subdirectorylibof the working directory, while
the header fileglui.hhas been copied into the subdirectoryincludeof the work-
ing directory. More generally, the library and its header files can be put in
appropriate system directories for use by others.


To compile a C++ program namedgoulis.ccand link it with GLUT, we
use the Unix makefile:


LIB = -I/usr/include/GL -I/usr/include/GL/freeglut -I./include \
-lX11 -lglut lib/libglui.a
goulis: goulis.cc
c++ -o goulis goulis.cc $(LIB)

where the backslash is a line continuation mark. Note that three libraries must
be linked with the C++ code.


A simple GLUI code contained in the fileprime.ccis listed below:
Free download pdf