OpenGL Frustum in Irrlicht

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
kparamas
Posts: 17
Joined: Fri Jun 26, 2009 10:00 pm

OpenGL Frustum in Irrlicht

Post 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.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post 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.
kparamas
Posts: 17
Joined: Fri Jun 26, 2009 10:00 pm

Post 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.
Post Reply