10

I've been using PyGame for a while and I have had to make coordinate transformations to change the normal coordinate system used in mathematics (with its origin at the bottom-left corner) to the PyGame coordinate system (with its origin at the top-left corner). I found this post very useful for that.

But I am wondering, why is PyGame using this odd coordinate system?

2
  • 3
    Your question is probably better on gamedev.stackexchange.com :) Nov 19, 2015 at 13:44
  • 1
    @IbrahimApachi, Based on the answer of Steve314 I guess that this post is related to computer graphics in general, not only to game development...
    – jchanger
    Nov 20, 2015 at 9:27

1 Answer 1

11

It's not just PyGame - it's an old convention for graphics displays. Many APIs allow you to override and choose your own convention, but even then, they are mapping back to that top-left-corner convention in the background.

The origin of the convention is easy to see for old CRT displays. The raster scan for each frame progressed top-down, with each line scanned left-to-right. Since the scan was done that way, the signal was sent that way, and the pixel buffer in memory was organized that way to allow the hardware to implement a relatively simple and efficient linear scan of memory for each frame.

With LCDs and other newer display technologies, I'm pretty sure the convention it's just for historic reasons - the legacy of a presumably arbitrary decision at one point about how the raster should scan out a picture for TV signals and CRTs many decades ago.

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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