Skip to main content
gamedev.net
🔒 Locked

2D Coordinates

Started by AdamYaxley 1 reply 950+ views
Original Post
AdamYaxley
AdamYaxley
I am currently building a game engine and I was wondering what the convention is regarding where the origin (0,0) of a 2D coordinate system resides.

Many libraries use the top left corner for the origin, however I would of thought it would make more sense if the coordinate system started from the bottom left.

What is everyones opinions on this?
I am currently looking for an internship in the games industry in Japan. Please visit my my portfolio.
????????????????????????????????????????????????????????
Brother Bob
Brother Bob
Consistency is more important to me than any of the specific choices. And I'm talking about consistency between all types of coordinates. For example, if you stick the origin in screen space at the bottom left corner, I expect the origin of the textures to be in the lower left corner of the image as well, so you have to ensure that textures are loaded bottom-up, and not top-down. Consistency is what makes the code simple, since you never have to compensate for inconsistencies.

Among the two conventions, I typically prefer bottom-left origins though. The reason is: in OpenGL, you can have the origin or almost any coordinate system anywhere you want and be consistent, with one exception; coordinates that are in absolute pixel coordinates. You can have the origin of screen space coordinates and texture coordinates anywhere you want, but pixel coordinates (like glViewport, glScissor and glWindowPos) are always specified with the bottom-left origin convention.
AdamYaxley
AdamYaxley
Excellent reply.

I totally agree, if a coordinate system is not consistent with the entire system then it would just get annoyingly confusing for the user. I will probably stick to the bottom left hand corner for now and see how that goes.

In the early days of video games development some of the old school consoles used to use the top left hand corner as an origin. Such consoles include the Gameboy Advance, where pixels in memory would be copied to the screen starting from the top left because that is how they were represented in memory, and how the particular hardware worked at the time. When technologies improved some old school developers probably still wanted to have the origin in the top left hand corner, since that is what they were used to.
I am currently looking for an internship in the games industry in Japan. Please visit my my portfolio.
????????????????????????????????????????????????????????

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.