Fundamentals of Computer Graphics
with Java, OpenGL, and Jogl
This is a list of source code files for examples in Fundamentals of Computer Graphics with Java, OpenGL, and Jogl.
- QuadraticBezierEdit.java and QuadraticBezierEditApplet.java, from Subsection 1.2.2. A program that demonstrates quadratic editing curves and allows the user to edit them.
- CubicBezierEdit.java and CubicBezierEditApplet.java, from Subsection 1.2.2. A program that demonstrates quadratic editing curves and allows the user to edit them.
- HierarchicalModeling2D.java and HierarchicalModeling2DApplet.java, from Subsection 1.3.2. A program that shows an animation constructed using hierarchical modeling with Graphics2D transforms.
- BasicJoglApp2D.java, from Subsection 2.1.1. An OpenGL program that just draws a triangle, showing how to use a GLJPanel and GLEventListener.
- BasicJoglAnimation2D.java and BasicJoglAnimation2DApplet.java, from Subsection 2.1.3. A very simple 2D OpenGL animation, using a rotation transform to rotate a triangle.
- JoglHierarchicalModeling2D.java and JoglHierarchicalModeling2DApplet.java, from Subsection 2.1.3. An animated 2D scene using hierarchical modeling OpenGL. This program is pretty much a port of HierarchicalModeling2D.java, which used Java Graphics2D instead of OpenGL.
- JoglHMWithSceneGraph2D.java, from Subsection 2.1.5. Another version of the hierarchical modeling animation, this one using a scene graph to represent the scene. The scene graph is built using classes from the source directory scenegraph2D.
- Axes3D.java, used for an illustration in Section 2.2. A very simple OpenGL 3D program that draws a set of axes. The program uses GLUT to draw the cones and cylinders that represent the axes.
- LitAndUnlitSpheres.java, used for an illustration in Subsection 2.2.2. A very simple OpenGL 3D program that draws four spheres with different lighting settings.
- glutil, introduced in Section 2.3 is a package that contains several utility classes including glutil/Camera.java for working with the projection and view transforms; glutil/TrackBall.java, for implementing mouse dragging to rotate the view; and glutil/UVSphere.java, glutil/UVCone.java, and glutil/UVCylinder.java for drawing some basic 3D shapes.
- PaddleWheels.java and PaddleWheelsApplet.java, from Subsection 2.3.1. A first example of modeling in 3D. A simple animation of three rotating "paddle wheels." The user can rotate the image by dragging the mouse (as will be true for most examples from now on). This example depends on several classes from the package glutil
- ColorCubeOfSpheres.java and ColorCubeOfSpheresApplet.java, from Subsection 2.3.2. Draws a lot of spheres of different colors, arranged in a cube. The point is to do a lot of drawing, and to see how much the drawing can be sped up by using a display list. The user can turn the display list on and off and see the effect on the rendering time. This example depends on several classes from the package glutil.
- TextureDemo.java and TextureDemoApplet.java, from Subsection 2.4.2. Shows six textured objects, with various shapes and textures. The user can rotate each object individually. This example depends on several classes from the package glutil and on textures from textures.
- PrimitiveTypes.java and PrimitiveTypesApplet.java, from Subsection 3.2.5. A 2D program that lets the user experiment with the ten OpenGL primitive types and various options that affect the way they are drawn.
- VertexArrayDemo.java and VertexArrayDemoApplet.java, from Section 3.4. Uses vertex arrays and, in OpenGL 1.5 or higher, vertex buffer objects to draw a cylinder inside a sphere, where the sphere is represented as a random cloud of points.
- IcosphereIFS.java and IcosphereIFSApplet.java, from Subsection 3.4.4. Demonstrates the use of glDrawElements, with or without vertex buffer objects to draw indexed face sets.
- WalkThroughDemo.java and WalkThroughDemoApplet.java, from Subsection 3.5.4. The user navigates through a simple 3D world using the arrow keys. The user's point of view is represented by an object of type SimpleAvatar, from the glutil package. The program uses several shape classes from the same package, as well as a basic implementation of 3D scene graphs found in the package simplescenegraph3d.
- MovingCameraDemo.java and MovingCameraDemoApplet.java, from Subsection 3.5.5. The program uses the simplescenegraph3d package to implement a scene graph that includes two AvatarNodes. These nodes represent the view of the scene from two viewers that are embedded in the scene as part of the scene graph. The program also uses several classes from the glutil package.
- LightDemo.java and LightDemoApplet.java, from Subsection 4.3.1. Demonstrates some light and material properties and setting light positions. Requires Camera and TrackBall from the glutil package.
- MovingLightDemo.java and MovingLightDemoApplet.java, from Subsection 4.4.2. The program uses the scenegraph3d package, a more advanced version of scenegraph3d, to implement a scene graph that uses two LightNodes to implement moving lights. The program also uses several classes from the glutil package.
- There are four examples in Section 4.5 that deal with textures: TextureAnimation.java, TextureFromColorBuffer.java, TextureLoading.java, and TextureCoordinateGeneration.java (and their associated applet classes). All of these examples use the glutil package.
- There are four examples in Chapter 5, a section at the end of the book that describes a few topices that not covered in the book proper. StereoGrapher.java demonstrates a form of stereo rendering that requires red/green 3D glasses; this program uses modified versions of the Trackball and Camera classes, which can be found in the stereoGraph3D package. SelectionDemo.java demonstrates using OpenGL's GL_SELECT render mode to let the user "pick" or "select" items in a 3D scene using the mouse; this demo is a modification of WalkThroughDemo.java and requires the packages glutil and simplescenegraph3d. Finally, MovingLightDemoGLSL.java and IcosphereIFS_GLSL.java demonstrate the use of "shaders" written in the OpenGL Shading Language (GLSL); these examples are modifications of MovingLightDemo.java and IcosphereIFS.java. The GLSL programs in these examples are very simple. The examples use a class, GLSLProgram.java, that is meant to coordinate the use of GLSL programs. MovingLightDemoGLSL requires the packages glutil and scenegraph3d.