8
\$\begingroup\$

Most of computer graphics systems use screen's top-left corner as staring point, but OpenGL uses bottom-to-top direction, why?

\$\endgroup\$
3
  • 2
    \$\begingroup\$ The origin is in the middle, not in a corner. \$\endgroup\$
    – Bálint
    Nov 20, 2016 at 8:01
  • \$\begingroup\$ @Bálint thanks for claryfying, I've fixed the question \$\endgroup\$
    – madneon
    Nov 27, 2016 at 8:29
  • 1
    \$\begingroup\$ Related: gamedev.stackexchange.com/questions/83570/… \$\endgroup\$
    – user1430
    Nov 28, 2016 at 18:06

3 Answers 3

8
\$\begingroup\$

Probably because that's how coordinate systems are traditionally set up when doing math. But to be honest, OpenGL can have its origin anywhere you want and its axes can point in any direction you want (well, so long as they are perpendicular to each other). If you want the origin in the top left and the Y-axis to point down, you simply set your model-view matrix to have a negative Y scale and a Y offset the height of the screen.

\$\endgroup\$
6
\$\begingroup\$

Think back to the graphs you would draw in school.

enter image description here

The (0,0) point is at bottom-left.

Now, OpenGL is an old, old API and it's derived from an even older one. There were no gaming graphics then; 3D graphics required an expensive workstation with an expensive professional accelerator, and were used for graphing, for CAD, for other professional tasks.

Hence OpenGL follows suit and places it's origin at bottom-left.

\$\endgroup\$
2
\$\begingroup\$

Perspective division performed on the Clip Coordinates produces Normalized Device Coordinates, ranging from -1 to 1 in all three axes. https://www.opengl.org/archives/resources/faq/technical/transformations.htm

\$\endgroup\$
1
  • 1
    \$\begingroup\$ +1, It's a good point. But some explanations right in the answer would be great. \$\endgroup\$ Nov 28, 2016 at 18:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .