A Camera in 2D

Up until now, you haven't had the concept of a camera in your code; you've only had the definition of your view frustum via glOrthof(), like this:

gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrthof(0, FRUSTUM_WIDTH, 0, FRUSTUM_HEIGHT, 1, -1);

From Chapter 6, you know that the first two parameters define the x-coordinates of the left and right edges of your frustum in the world, the next two parameters define the y-coordinates of the bottom and top edges of the frustum, and the last two parameters define the near and far clipping planes. Figure 8–19 shows that frustum again.

images

Figure 8–19. The view frustum ...

Get Beginning Android 4 Games Development 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.