[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion




try to use glOrtho instead og gluOrtho2D and see if you still get the same # glOrtho(left, right, bottom, top, zNear, zFar) glOrtho(0, 640, 480, 0, 1, 0) should set 0,0 to the left,top



Chris Ashurst wrote:
I think on all systems (and if you're used to getting mouse x/y coordinates
via the SDL side of pygame) the mouse is "flipped" when you use OpenGL.

I think it's something to do with the fact that OpenGL itself is device and
system agnostic, and was built with the idea in mind that it's just a 3d
engine rather than a 3d engine + widgets.

Additionally, it may also be something to do with the fact that any object
you manipulate in an OGL context is relative to the "camera", and to move
the camera around an object you have to move it right if you want the object
to move left, up to move it down and so on.

People with more experience with OpenGL can probably clarify, but I have hit
this same issue before, too. I think the x coord turned out to be fine, all
I needed to do was write a function that inverted the y coordinate to get
the "real" value.

-----Original Message-----
From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx]On
Behalf Of Dave LeCompte (really)
Sent: Tuesday, January 16, 2007 20:20
To: pygame-users@xxxxxxxx
Subject: [pygame] MacOS/PyGame/PyOpenGL mouse inversion


Hi there, I'm new to the list, so this may have been answered before.

I've got a PyGame/PyOpenGL app that I'm working on which I can run under
MSWindows or Mac OSX and in windowed or fullscreen mode. I notice that
when I run in a window on my Mac, the value returned by
pygame.mouse.get_pos() is relative to the lower left corner of the screen,
but if I run fullscreen on the Mac, fullscreen on by Windows PC, or in a
window on the Windows PC, the value is relative the the upper left corner
(agreeing with the docs at
http://www.pygame.org/docs/ref/mouse.html#pygame.mouse.get_pos ).

Is this a known issue?

Attached is a short test script that displays the strange behavior.

-Dave LeCompte




CONFIDENTIAL NOTICE: This email including any attachments, contains confidential information belonging to the sender. It may also be privileged or otherwise protected by work product immunity or other legal rules. This information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this emailed information is strictly prohibited. If you have received this email in error, please immediately notify us by reply email of the error and then delete this email immediately.