Certainly the major goal is to help you learn computer graphics technology through the use of a modern API like OpenGL while developing an understanding of the underlying mathematics and algorithms. Equally important, however, is to focus on software design patterns and architectures as well as common interactive event handling schemes that facilitate interactive operations, maximize code reuse, and scale up to large programs. There is much more to making effective use of an API like OpenGL than just learning the basic API entry points. The hope is that by learning a useful design pattern along with common event handling schemes at the same time you are learning the graphics techniques, you will more quickly become a proficient OpenGL developer.
The example code presented on the pages of this web site is written using a
common simplification of the well-known and heavily-used
model-view-controller design pattern.
An in-depth explanation of that design pattern is beyond the scope of these
notes. A great wealth of references and detailed explanations
is easily found in books and online. In small to medium graphics applications
where it is not anticipated that the "model" implementation
will have a use outside
the context of the graphics program (and indeed, there may not even be a
complete standalone representation of the model aside
from its implicit representation in your code and its data declarations),
it is common to lump the Model and the View together into
one class – the ModelView
.
That is what you will see in the examples we will be studying, and it will be
the general pattern you will use in the projects you develop for this course.
An advantage to this design pattern arises when you move a given program across the
various environments
mentioned in the Versions section (i.e., when you move among desktop OpenGL, OpenGL ES,
WebGL, and JOGL).
Aside from any required language translation,
nearly all required changes are in the Controller
. The ModelView
can often be left nearly untouched. (One notable exception relates to vertex array objects,
the use of which is
required in modern OpenGL programs, but not supported in either WebGL or OpenGL ES 2.)
The "Mountain Village" example on the right is running on an android phone; the "shapes" example
on the left
is running on a Samsung Galaxy android tablet. We will see OpenGL 4 versions of
these demonstration programs in this course. The versions you see running here were created
after making the code changes described here.
The fact that most substantive changes go into the Controller
should not
be surprising since the Controller
is
the object responsible for interfacing with the underlying window and event manager
environment, and that is what changes most significantly across the
various platforms.
This site has a series of sample programs illustrating increasingly sophisticated techniques. Early programs in these sets are complete standalone programs that you can run, tweak, and study. As we progress through the sets, your understanding of OpenGL in general and our framework in particular should become increasingly solid. As a result, code posted for later examples will not necessarily be complete. Some portions may be left as optional exercises for you to complete. Other code examples may be provided in isolation, requiring integration in complete programs to execute. Experience has clearly shown that requiring more such integration on your part is necessary to solidify your understanding of the architecture and functionality of OpenGL. You should be able to integrate new features as we learn them without the need to see them actually embedded in a full working program.