In the last chapter, I described two programming frameworks for JOGL (callbacks and active rendering), with a simple rotating cube as the example. In this chapter, I utilize the active rendering framework to build a more substantial application, a small 3D world.
The visual elements are:
The user can move around the world using the arrow keys to go forward, backwards, left, right, up, down, and turn left and right, but the player can't travel off the checkerboard or beyond the borders of the skybox. The game is terminated by pressing ESC, q, END, or ctrl-c, or by clicking the close box.
TourGL is a very basic game - the user must navigate over the red R's lying on the ground to make them disappear. The game ends when all the R's have been deleted, and a score is calculated based on how long it took to delete the R's.
Since TourGL utilizes the active rendering framework, the game automatically suspends when the window is iconified or deactivated, and can be resized. TourGL also offers two extensions to the framework:
Various OpenGL (JOGL) techniques are illustrated in this example, including transparent images as textures, 2D overlays, and bitmap and stroke fonts.