[Perspective Tour] Chapter 13.5.   Touring the Town

 

This chapter does not appear in the book.

 

Car racing games are great fun, and don't need complicated 3D rendering to look good. In this chapter, I start with a simple 2D car touring application called TourLand, which is shown below on the right. I'll extend the code in two steps, finishing with a version that seems to use 3D, but is actually "fakin' it" with a 2D perspective trick (see picture on the right).

[2D Tour]

The 2D TourLand displays a red racing car at the center of the window (it's quite hard to see in the picture), which moves and turns in response to user key presses. The 3D version draws the back of the racing car on the bottom edge of the window in the middle. Key presses don't affect the car image instead the view of the map changes.

Perhaps surprisingly, much of the code in the 2D versions of TourLand can be reused in the fake 3D version. In particular, the 2D classes let me test:

The fake 3D version utilizes JAI (the Java Advanced Imaging library) to perform fast, hardware-supported, perspective warping transformations on the map.

 

Downloads


Navigation:


Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page