Ortho camera clipping [SOLVED]

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
Auradrummer
Posts: 260
Joined: Thu Apr 17, 2008 1:38 pm
Location: Brasopolis - Brazil

Ortho camera clipping [SOLVED]

Post by Auradrummer »

Hello Masters,

I'm playing with a orthogonal camera using:

Code: Select all

ortho.buildProjectionMatrixOrthoLH( SCREEN_W * 4 * zoom, SCREEN_H * 4 * zoom, 20, 2000);
cam->setProjectionMatrix(ortho);
Is good, but when I move the camera and the mesh touches the border of the screen it is not rendered, simply disappear.
How can I solve this?

Thanks
Last edited by Auradrummer on Wed Feb 14, 2018 12:58 am, edited 1 time in total.
Professional Software Developer and Amateur Game Designer ;-)
MartinVee
Posts: 139
Joined: Tue Aug 02, 2016 3:38 pm
Location: Québec, Canada

Re: Ortho camera clipping

Post by MartinVee »

Do you have a MCV (Minimal, Complete, Verifiable) example code? Those two lines of code seems to be good, depending on the context.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Ortho camera clipping

Post by Mel »

setProjectionMatrix has a default boolean parameter named "isOrthogonal" that is false, unless otherwise specified, meaning the provided projection matrix isn't orthogonal. If you are performing orthographic renderings you want to set that to "true", like this:

Code: Select all

cam->setProjectionMatrix(ortho,true);
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Auradrummer
Posts: 260
Joined: Thu Apr 17, 2008 1:38 pm
Location: Brasopolis - Brazil

Re: Ortho camera clipping

Post by Auradrummer »

Sorry for the delay in reply. Problem solved.

I made my mesh by loading a XML. So, the bounding box was constrained to the "start" of the mesh. As the clipping method is based in bounding boxes....

Thanks!
Professional Software Developer and Amateur Game Designer ;-)
Post Reply