Page 1 of 1

OpenGL Frustum in Irrlicht

Posted: Fri Aug 28, 2009 2:21 am
by kparamas
// Projection Transformation
// =========================
glMatrixMode(GL_PROJECTION);
glLoadIdentity();


glFrustum( (-H_SCREENEDGE-my_camera.eye_pos[COORD_X]) * nearplane/my_camera.eye_pos[COORD_Z] * 0.3, // left
(H_SCREENEDGE-my_camera.eye_pos[COORD_X]) * nearplane/my_camera.eye_pos[COORD_Z] * 0.3, // right
(-V_SCREENEDGE-my_camera.eye_pos[COORD_Y]) * nearplane/my_camera.eye_pos[COORD_Z] * 0.3, // bottom
(V_SCREENEDGE-my_camera.eye_pos[COORD_Y]) * nearplane/my_camera.eye_pos[COORD_Z] * 0.3, // top
nearplane, // zNear
VIEWFARPLANE); // zFar

// Objects
// =======
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

// Need to translate the model geometry due to the camera position transformation.
glTranslatef(-my_camera.eye_pos[COORD_X], -my_camera.eye_pos[COORD_Y], -my_camera.eye_pos[COORD_Z] * 0.6 + 0.25);

I have this above code in OpenGL. I want to import the same in Irrlicht camera.

Is it needed to make the projection matrix in Irrlicht?
I noticed there is only,
camera->getViewMatrix();

and there is NO setViewMatrix() for the camera.

Please let me know how to proceed with this.

Posted: Fri Aug 28, 2009 6:50 am
by devsh
i had same thing happen to me... there is no set view matrix because the camera need to make its own... if you were able to modify view matrix then you'd modify target and position of the camera.

just use set position, target and they will make nice view mtrices.

Posted: Fri Aug 28, 2009 6:02 pm
by kparamas
Thanks devsh.

I saw your Ninja Project. Looks interesting. I am using IrrNewton in my code.

Please let me know if I can join you in the code.