Orthographic view

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
beamlight
Posts: 1
Joined: Mon Dec 20, 2021 1:48 pm

Orthographic view

Post by beamlight »

Hi I am currently working on a world hardest game clone in irrlicht. I want to implement a Orthographic view camera, but I don´t know how to achieve it. Currently I have a perspective camera but want my meshes to be facing the camera. Do someone have a example or how I can set up Orthrographic view?
CuteAlien
Admin
Posts: 9646
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Orthographic view

Post by CuteAlien »

You set your own projection matrix to the camera. But Irrlicht can create it for you.
Something like:

Code: Select all

// Assuming you have already set position and target for camera
irr::core::matrix4 orthoMat;
orthoMat.buildProjectionMatrixOrthoLH(  width,
										height,
										ORTHO_CAM_ZNEAR,
										ORTHO_CAM_ZFAR,
										D3DStyle
										);

camera->setProjectionMatrix(orthoMat, true);
So first set position and target for camera. Then set how many units you want to see there (width/height/near/far).
The D3DStyle is only availabe in svn trunk (in Irrlicht 1.8 it's always true I think). So in trunk simply set it to true when you use Direct3D and false when you work with OpenGL (otherwise you get a tiny error in znear - most people won't even notice I suppose).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply