Game Development Reference
In-Depth Information
Chapter 11
3D Programming Tricks
3D programming is an incredibly wide and complex field. This chapter explores some topics that
are the absolute minimum requirement to write a simple 3D game:
ï?®
We'll revisit our friend the vector and attach one more coordinate.
ï?®
Lighting is a vital part of any 3D game. We'll look at how to perform simple
lighting with OpenGL ES.
ï?®
Defining objects programmatically is cumbersome. We'll look at a simple
3D file format so that we can load and render 3D models created with 3D
modeling software.
ï?®
In Chapter
8, we discussed object representation and collision detection.
We'll look at how to do the same in 3D.
ï?®
We'll also briefly revisit some of the physics concepts that we explored in
Chapter 8—this time in a 3D context.
Let's start with 3D vectors.
Before We Begin
As always, we'll create a couple of simple example programs in this chapter. To do that, we just
create a new project and copy over all of the source code of the framework we've developed
so far.
As in previous chapters, we'll have a single test starter activity that presents us with the tests
in the form of a list. We'll call it GLAdvancedStarter and make it our default activity. Simply copy
over the GL3DBasicsStarter , and replace the class names of the tests. We also need to add each
of the test activities to the manifest with a proper <activity> element.
Each of the tests will extend GLGame as usual; the actual code will be implemented as a GLScreen
instance that we'll hook up with the GLGame instance. As in Chapter 10, to conserve space, we'll
present only the relevant portions of the GLScreen implementations. All of the tests and the
529
 
Search WWH ::




Custom Search