Original Post
Hi guys, i'm trying to figure out the math behind finding a view matrix and a projection matrix.
Okay here are my constant
int windowWidth = 640, windowHeight = 480;
VECTOR3D cameraPosition(50.0f,-10.0f,50.0f);
VECTOR3D cameraTarget(50.0f,-10.0f, 0.0f);
so simply a camera that look right to the ground (sort of top-down view)
i determine is viewMatrix with
gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z, cameraTarget.x, cameraTarget.y, cameraTarget.z,0.0f, 1.0f, 0.0f);
how am i suppose to determine the camera projection matrix?
i use
gluPerspective(45.0f, (float)windowWidth/windowHeight, 1.0f, 100.0f);
Is it the right way to do it? Thank you
Okay here are my constant
int windowWidth = 640, windowHeight = 480;
VECTOR3D cameraPosition(50.0f,-10.0f,50.0f);
VECTOR3D cameraTarget(50.0f,-10.0f, 0.0f);
so simply a camera that look right to the ground (sort of top-down view)
i determine is viewMatrix with
gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z, cameraTarget.x, cameraTarget.y, cameraTarget.z,0.0f, 1.0f, 0.0f);
how am i suppose to determine the camera projection matrix?
i use
gluPerspective(45.0f, (float)windowWidth/windowHeight, 1.0f, 100.0f);
Is it the right way to do it? Thank you