0
\$\begingroup\$

I have perfect square screen and I want to capture everything between -1000.0f and 1000.0f, so I create projection matrix like that:

var proj = Matrix.CreateOrthographicOffCenter(left: -width,
                                              right: width, 
                                              bottom: -height,
                                              top: height, 
                                              zNearPlane: -1.0f, 
                                              zFarPlane: 1.0f);

I expect the axes to be X - left >>> right and Y down >>> up, but if I project some points with Vector2.Transform I get following:

(-1000, -1000) is (-1, -1)
(1000, 1000) is (1, 1)

I expect -1 on Y axis to be the top of the screen, but it is actually the bottom. How so? Is there some convention I missed?

\$\endgroup\$
1
\$\begingroup\$

The OpenGL and DirectX coordinate systems are traditional cartesian coordinate systems. (0, 0) is in the center, the positive x direction is to the right and the positive y direction is to up.

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.