I need the view to show the road polygon (a rectangle 3.f * 100.f) with a vanishing point for a road being at 3/4 height of the viewport and the nearest road edge as a viewport's bottom side. See Crazy Taxi game for an example of what I wish to do.
I'm using iPhone SDK 3.1.2 default OpenGL ES project template.
I setup the projection matrix as follows:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustumf(-2.25f, 2.25f, -1.5f, 1.5f, 0.1f, 1000.0f);
Then I use glRotatef to adjust for landscape mode and setup camera.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(-90, 0.0f, 0.0f, 1.0f);
const float cameraAngle = 45.0f * M_PI / 180.0f;
gluLookAt(0.0f, 2.0f, 0.0f, 0.0f, 0.0f, 100.0f, 0.0f, cos(cameraAngle), sin(cameraAngle));
My road polygon triangle strip is like this:
static const GLfloat roadVertices[] = {
-1.5f, 0.0f, 0.0f,
1.5f, 0.0f, 0.0f,
-1.5f, 0.0f, 100.0f,
1.5f, 0.0f, 100.0f,
};
And I can't seem to find the right parameters for gluLookAt. My vanishing point is always at the center of the screen.