Chapter 7

Camera

WHAT’S IN THIS CHAPTER?

  • Building a touch-and-go camera
  • Implementing frustum clipping based on the current model view and projection matrix
  • Building and integrating a fly mode into your camera
  • Creating a first-person shooter camera with collision detection
  • Building a 3D camera tracking system
  • Orbiting a camera around a specific object
  • Using a Bullet collision ray
  • Creating a third-person camera with collision detection

This chapter is all about cameras, the view matrix, and the frustum. You will learn how to create five different types of cameras through practical examples that will give you all the necessary knowledge to either integrate them inside your apps or build your own.

Another important aspect of this chapter is clipping (how to determine if an object is visible or not from the current camera view). This chapter will demonstrate how to use a universal method based on the model view and a projection matrix to build the six planes that form the view frustum.

Once the frustum is created, you will learn how to test the bounding box, bounding sphere, and points against the frustum to determine their visibility. You will also discover how to get the distance of a bound (perfect for geometry or shader LOD), and learn how to test if an object is inside, outside, or intersects the frustum.

TOUCH AND GO!

In order to gently get started, let’s first implement what I like to call a touch-and-go camera control. To quickly explain how this type of camera works, as ...

Get Game and Graphics Programming for iOS and Android® with OpenGL® ES 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.