[Y-devel] Re: Measuring lengths (pixels or something else?)
Chris Amshey ychris at amshey.net
Fri Feb 27 18:58:21 GMT 2004
On Fri, Feb 27, 2004 at 07:05:45PM +0100, Rupert Mazzucco wrote:
> The PostScript/PDF model has the origin in the lower left, now
> I learn that OpenGL does, too. So it's not like programmers never
> heard of that system; and they likely had some maths in school.
OpenGL implements a virtual space that undergoes much processing
before being written to the screen, and is essentially a vector
matrix representation of the universe. I don't know too much about
postscript, but I do believe that it's also vector and not bitmap
based. The consequence here is, 'much math is done before display'.
The reason for the upper-left origin is because of the way video cards
layout memory which is done because of the way monitors draw scanlines...
starting in the upper left, and drawing lines all the way down. (LCD
monitors artificially imitate this behaviour so as to simplify videocard
to lcd screen translations. They don't fundamentally need to do scanlines,
but do anyway.)
We could start in any corner, and we could organize our memory in
columns instead of rows, but when it goes to the video-card it will
need to be switched around. Since the origin is essentially arbitrary
from the human point of view, but important from the computer point
of view, it goes in the upper-left corner.
I guarantee that when GL or postscript rasterize, they start in the
upper-left corner, even if 'user coordinates' are lower-right.
Whether the time is -significant- or not may be debatable on to-days
processors, and the extra cost of 'translation' for well-organized data
comes to a pointer-decrement at the end of each row, which isn't a
lot of processing today, but, that's where it comes from.
And as much as it's a tiny amount of processing to-day, it seems strange
to me to want to deliberately store our data backwards...
--Chris
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved