Jonathan Hartley wrote:
I'm wondering whether it's possible to compensate for non-square pixels.
Using vector graphics drawn from OpenGL, in some resolutions my
circles are wider than they are tall, and in other resolutions they
are taller than they are wide. At my LCD's max, native resolution, the
circles are perfect, and to confirm this, the aspect of this max
screen resolution matches the physical measurements of the screen.
Other resolutions vary in aspect ratio from 1.25 up to 1.7, with a
corresponding distortion to the graphics onscreen.
I started out trying to compensate for non-square pixels when running
in lower resolutions , by setting my gluOrtho2D params. I assume that
the max available resolution on a display comprises square pixels, and
then compare the current resolution's aspect ratio to this. This works
great, in both fullscreen and windowed mode.
However, then I switched from Linux to Windows, and on the same
hardware, this time the drivers provide modes which have 'black bars'
down the sides. So the reported resolution does not use the whole
screen real estate. This throws off my 'compenation' calculation, and
in fact pretty much makes it redundant, so I'd like to stop performing
this pixel aspect correction in this case. But I've no idea how to
detect this circumstance from software.
I guess I could have a manual tweak for pixel aspect ratio, that the
user could set. Meh.
I assume automating this can't reliably be done, unless someone has
information to the contrary. Ideas, thoughts, etc, welcome.
Jonathan
Yes, easily done... not with a call for that specific purpose, but
OpenGL provides the building blocks necessary to achieve the desired
result for any size/shape/number of pixels.
With a call to glViewport, you set the range of pixels you are using,
and with a call to one of glFrustum, gluPerspective, glOrtho or
gluOrtho2D, you set the range of world space coordinates you wish to use.
In a normal square-pixel situation, the viewport's height/width ratio
should equal the frustum's height/width ratio. In non-square-pixel
situations, those two ratios will differ.
Equations can be provided if anyone cares to see the specifics ...
Gary Herron
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en.