Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Display coordinate origin?

This thread is locked; no one can reply to it. rss feed Print
Display coordinate origin?
AleaInfinitus
Member #18,873
December 2020

I couldn't find anything directly related to this in the docs, and looking it up showed a similar question where someone said that the pixel coordinates start at (1,1). Does the display do the same? Would a mouse click on the top left pixel of a display count as (1,1) or (0,0)?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Chris Katko
Member #1,881
January 2002
avatar

someone said that the pixel coordinates start at (1,1)

Where did you see that?

It should be (0,0) or (0.5, 0.5) (see the primatives addon docs because "pixels" in 3D APIs have to be "centered" on the pixel or anti-aliasing will screw up. In that case, simply add 0.5 at the end. But since I don't use anti-aliased lines I've never even had the problem show up.)

There are things like (-1,-1) to (1,1) floating point device space and stuff like that but since Allegro is already setting up the "transforms" you should only have to specify the usual screen/window coordinates.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Go to: