Programming and Graphics

(Kiana) #1

198 Introduction to C++ Programming and Graphics


At the time the VOGLE project get under way, the wife of one of the developers was
working for a library and an article about a group of European Zoologists who came
out to study Australian native animals happened to cross her desk. Unfortunately,
the title of this worthy piece of science is currently lost, however, by way of summary,
we are sad to report that the intention of the investigation (at least originally) was
to demonstrate that since Australian native animals are, in a sense, less evolved
than their European counterparts they are also less intelligent. It happened that one
of the animals helping the scientists in their investigations was an echidna and it
was given the task of learning a maze on the basis of receiving a reward by pushing
a button on a machine at the other end of the maze. Having demonstrated that
it was quite capable of learning a maze, the scientists were then faced with finding
the answer to the next question. If we take the food out of the machine, how
will the echidna react? Will it be dumb enough to keep running through the maze
again and again? What will it do? So they took the food out of the machine.
And this is what happened. The echidna ran through the maze, pushed the button
on the machine, no food came out. The echidna pushed the button again, again
no food came out. It then turned and looked up at the observers giving them
what was described as a “filthy look” and proceeded not only to destroy the food
dispensing machine, but to introduce the observers to how one can traverse a maze
in a straight line by pushing the walls down! It is to the memory of this echidna
(which we dubbed Eric H. Echidna), this software is duly dedicated.


Testimonial:Taken from theVogleInternet site dedicated to Eric H. Echidna
(http://bund.com.au/~dgh/eric).


This will start the X11 server that allows us to displayVoglegraphics on the
Windows desktop.


In this chapter, we demonstrate the usage of theVoglelibrary and
discuss simple and advanced applications that illustrate the basic concepts of
graphics programming, including animation and user control by the mouse and
keyboard. Further examples can be found in the directoryexamplesof the
Vogledistribution. A extensive collection of applications in Computational
Fluid Dynamics (CFD) throughFortran 77code can be found in the library
Cfdlab;seehttp://dehesa.freeshel.org/CFDLAB


7.1 Compilation..............................


To compile a C++ program namedoliver.ccresiding in a certain directory of
a Linux system, we compose the makefile:

Free download pdf