PDA

View Full Version : Matrix Multiplication



Jose Ricardo
12-08-2009, 05:06 PM
Hi People,

I'm having some trouble trying to understand how to manage working with projection matrix, specifically with orthographic one.

For example, using one the X axis, I set my left coord to -11 and my right coord to -1. In this case, I will have -(l + r)/2 => -(-11 - 1) / 2 => 12/6 => 6.
How is it possible if I've defined a volume of 10? Is there a rule that the right coord must be positive?

Thanks!

Ilian Dinev
12-08-2009, 07:47 PM
http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml

Here you see that X and Y's signs are kept, Z's sign is flipped.

X is positive to the right of the screen, Y is bottom-up.
You can define whatever direction you want.
The proj. matrix simply transforms vertex coordinates to clipspace. With the glOrtho you define which region (a cuboid) of view-space will be contained in clipspace, and whether to flip each of the 3 axes. No rules, so don't wonder and go with whatever values are comfortable for your project. I.e some 2D games flip Y, and make the top-left match [0;0], for the convenience in staying with the convention they've been using for years.