Fundamentals of Computer Graphics
with Java, OpenGL, and Jogl
Preliminary Partial Version, May 2010
Preface
These notes represent an attempt to develop a new computer graphics course at the advanced undergraduate level. The primary goal, as in any such course, is to cover the fundamental concepts of computer graphics, and the concentration is on graphics in three dimensions. However, computer graphics has become a huge and complex field, and the typical textbook in the field covers much more material than can reasonably fit into a one-semester undergraduate course. Furthermore, the selection of topics can easily bury what should be an exciting and applicable subject under a pile of detailed algorithms and equations. These details are the basis of computer graphics, but they are to a large extent built into graphics systems. While practitioners should be aware of this basic material in a general way, there are other things that are more important for students on an introductory level to learn.
These notes were written over the course of the Spring semester, 2010. More information can be found on the web page for the course at http://math.hws.edu/eck/cs424/. The notes cover computer graphics programming using Java. Jogl is used for three-dimensional graphics programming. Jogl is the Java API for OpenGL; OpenGL is a standard and widely used graphics API. While it is most commonly used with the C programming language, Jogl gives Java programmers access to all the features of OpenGL. The version of Jogl that was used in this course was 1.1.1a. A new version, Jogl 2, was under development as the course was being taught, but Jogl 2 is still listed as a "work in progress" in May 2010. (Unfortunately, it looks like Jogl 1.1.1a will not be upward compatible with Jogl 2, so code written for the older version will not automatically work with the new version. However, the changes that will be needed to adapt code from this book to the new version should not be large.)
As often happens, not as much is covered in the notes as I had hoped, and even then, the writing gets a bit rushed near the end. A number of topics were covered in the course that did not make it into the notes. Some examples from those topics can be found in Chapter 5 (which is not a real chapter). In addition to OpenGL, the course covered two open-source graphics programs, GIMP briefly and Blender in a little more depth. Some of the labs for the course deal with these programs. Here are the topics covered in the four completed chapters of the book:
- Chapter 1: Java Graphics Fundamentals in Two Dimensions. This chapter includes a short general discussion of graphics and the distinction between "painting" and "drawing." It covers some features of the Graphics2D class, including in particular the use of geometric transforms for geometric modeling and animation.
- Chapter 2: Overview of OpenGL and Jogl. This chapter introduces drawing with OpenGL in both two and three dimensions, with very basic color and lighting. Drawing in this chapter uses the OpenGL routines glBegin and glEnd. It shows how to use Jogl to write OpenGL applications and applets. It introduces the use of transforms and scene graphs to do hierarchical modeling and animation. It introduces the topic of optimization of graphics performance by covering display lists.
- Chapter 3: Geometric Modeling. This chapter concentrates on composing scenes in three dimensions out of geometric primitives, including the use of vector buffer objects and the OpenGL routines glDrawArrays and glDrawArrayElements. And it covers viewing, that is, the projection of a 3D scene down to a 2D picture.
- Chapter 4: Color, Lighting, and Materials. This chapter discusses how to add color, light, and textures to a 3D scene, including the use of lights in scene graphs.
Note that source code for all the examples in the book can be found in the source directory on-line or in the web site download.
The web site and the PDF versions of this book are produced from a common set of sources consisting of XML files, images, Java source code files, XSLT transformations, UNIX shell scripts, and a couple other things. These source files require the Xalan XSLT processor and (for the PDF version) the TeX typesetting system. The sources require a fair amount of expertise to use and were not written to be published. However, I am happy to make them available upon request.
Professor David J. Eck
Department of Mathematics and Computer Science
Hobart and William Smith Colleges
Geneva, New York 14456, USA
Email: eck@hws.edu
WWW: http://math.hws.edu/eck/