Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
> I'm not sure how you got the older version, and why pygame is loading > it... I'm pretty sure I installed 1.8.0pre from the pythonmac.org > universal binary prebuilt: Yeah, that looks like the same place I installed from, too. This weekend, I'll do some exploring around my installation and see if I can turn up any clues - perhaps my last upgrade left things in a slightly inconsistent state. Thanks for the assistance. -Dave LeCompte
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
On 1/18/07, Dave LeCompte (really) <[EMAIL PROTECTED]> wrote: > call: > print pygame.base.get_sdl_version() (1, 2, 7) Ah - that must be the issue... mine is (1, 2, 11).. the sdl bug with the y inversion must have been fixed somewhere between patch 7 and patch 11 I'm not sure how you got the older version, and why pygame is loading it... I'm pretty sure I installed 1.8.0pre from the pythonmac.org universal binary prebuilt: http://pythonmac.org/packages/py24-fat/mpkg/pygame-1.8.0pre-py2.4-macosx10.4.zip and that it installed the framework build of sdl... do you know where you installed from?
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
> Dave, what sdl version is pygame calling when you see the inverted > mouse problem? > > call: > print pygame.base.get_sdl_version() (1, 2, 7) > to confirm, if you run your script and the diamond follows the mouse, > everything is working correctly, right? i.e. when the y is inverted > the diamond is at the wrong spot, yes? Yep, the diamond should be under the cursor at all times, and if the y is inverted, the diamond will show up somewhere else. There's a triangle at the top of the screen as a sanity check - if my drawing was inverted, the triangle would be at the bottom of the screen, but that always shows up correctly. > > On 1/18/07, Dave LeCompte (really) <[EMAIL PROTECTED]> wrote: >> I'm running Mac OS X 10.4.8, and my pygame version is 1.8.0pre. >> >
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
Dave, what sdl version is pygame calling when you see the inverted mouse problem? call: print pygame.base.get_sdl_version() to confirm, if you run your script and the diamond follows the mouse, everything is working correctly, right? i.e. when the y is inverted the diamond is at the wrong spot, yes? On 1/18/07, Dave LeCompte (really) <[EMAIL PROTECTED]> wrote: I'm running Mac OS X 10.4.8, and my pygame version is 1.8.0pre.
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
I'm running Mac OS X 10.4.8, and my pygame version is 1.8.0pre. > I ran the sample script provided on an intel iMac OS X 10.4.8 with > pygame 1.8.0pre and both windowed and full-screen behaved correctly > (the diamond followed the mouse) > > according to the headers for the framework sdl build I've got, it's 1.2.11 > > It makes sense to me that it would be fixed in the latest because I > looked at the libsdl mailing list archives and this post seemed to be > a patch for the problem: > http://www.libsdl.org/pipermail/sdl/2005-November/071307.html > and this post indicated it had been applied: > http://www.libsdl.org/pipermail/sdl/2005-November/071404.html > > So Dave, > what OS X version are you running on? Can you tell which SDL your > pygame is running on? >
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
I ran the sample script provided on an intel iMac OS X 10.4.8 with pygame 1.8.0pre and both windowed and full-screen behaved correctly (the diamond followed the mouse) according to the headers for the framework sdl build I've got, it's 1.2.11 It makes sense to me that it would be fixed in the latest because I looked at the libsdl mailing list archives and this post seemed to be a patch for the problem: http://www.libsdl.org/pipermail/sdl/2005-November/071307.html and this post indicated it had been applied: http://www.libsdl.org/pipermail/sdl/2005-November/071404.html So Dave, what OS X version are you running on? Can you tell which SDL your pygame is running on?
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
Dave LeCompte (really) wrote: This is all good knowledge to have, to be sure, but I think we're wandering afield from my original issue - I didn't want to ask about the default OpenGL coordinate systems, I'm reporting that the same code behaves differently on a Mac in a window than anywhere else. Run the code fullscreen on a Mac, it behaves as I expect. Run the code on a MSWindows PC, it behaves as I expect. I'm proceeding with the understanding that this is a known and resolved bug in the Mac SDL code and will be fixed when the 1.8 (final) binaries of PyGame are ready. Sorry, made a mistake; the Pygame mac binary (1.7, haven't checked 1.8pre) includes SDL 1.2.11, which is current. Evidentally the issue is known but not resolved (some Googling on the topic will give you an idea of which releases of SDL it is fixed in, and which ones it is broken in). Alex.
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
This is all good knowledge to have, to be sure, but I think we're wandering afield from my original issue - I didn't want to ask about the default OpenGL coordinate systems, I'm reporting that the same code behaves differently on a Mac in a window than anywhere else. Run the code fullscreen on a Mac, it behaves as I expect. Run the code on a MSWindows PC, it behaves as I expect. I'm proceeding with the understanding that this is a known and resolved bug in the Mac SDL code and will be fixed when the 1.8 (final) binaries of PyGame are ready. Thanks, Dave LeCompte > On 1/17/07, Chris Ashurst <[EMAIL PROTECTED]> 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. >> >> 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. >> > If your use of openGL changes anything about the mouse coordinates > returned from pygame, then I think it's a bug, like Alex says. Moving > the mouse down (towards you) should always make it's y position > increase, and moving it up (away from you) should always make it's y > position decrease. > > However, when it comes to window coordinates, openGL by default uses a > coordinate system where 0,0 is the lower left, and positive x goes > right and positive y goes up. This is different from most computer > systems where y goes down and 0,0 is the upper left. OpenGL uses the > system it does because it follows the conventions of the cartesian > coordinate space used in math & physics. The place where you'd notice > this the most in games is when using trig functions like sin & cos, > which also are designed for math & physics & openGL coordinate systems > (positive rotations are counter-clockwise, 0 degrees is straight right > & y is up) > > So basically, I'm saying it's not that the mouse is "flipped" with > OpenGL, it's that unless you set up your transforms to change it, > OpenGL is "flipped" from what all the pygame/SDL and desktop position > stuff is >
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
On 1/17/07, Chris Ashurst <[EMAIL PROTECTED]> 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. 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. If your use of openGL changes anything about the mouse coordinates returned from pygame, then I think it's a bug, like Alex says. Moving the mouse down (towards you) should always make it's y position increase, and moving it up (away from you) should always make it's y position decrease. However, when it comes to window coordinates, openGL by default uses a coordinate system where 0,0 is the lower left, and positive x goes right and positive y goes up. This is different from most computer systems where y goes down and 0,0 is the upper left. OpenGL uses the system it does because it follows the conventions of the cartesian coordinate space used in math & physics. The place where you'd notice this the most in games is when using trig functions like sin & cos, which also are designed for math & physics & openGL coordinate systems (positive rotations are counter-clockwise, 0 degrees is straight right & y is up) So basically, I'm saying it's not that the mouse is "flipped" with OpenGL, it's that unless you set up your transforms to change it, OpenGL is "flipped" from what all the pygame/SDL and desktop position stuff is
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
To clarify: glOrtho and gluOrtho2D behave identically to eachother - switching to glOrtho didn't fix the problem. I have since created a wrapper to work around the bug when running in a window on the Mac. Thanks again, Dave LeCompte > "altern" wrote: >> No, it's a known (and resolved in later versions) bug in SDL. >> Workaround locally by flipping Y or use a later version. > > My pygame.__version__ reports '1.8.0pre', which suggests to me that this > bug fix hasn't made it into the latest Mac binaries. > > > "altern" wrote: >> 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 > > Replacing glOrtho with glOrtho2D produced identical results on all > platforms, including the inconsistency on the Mac when windowed. > > > Thanks for the help. > -Dave LeCompte > > >> >> >> >> 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: [EMAIL PROTECTED] >>> [mailto:[EMAIL PROTECTED] >>> Behalf Of Dave LeCompte (really) >>> Sent: Tuesday, January 16, 2007 20:20 >>> To: pygame-users@seul.org >>> 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. >>> >> >
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
"altern" wrote: > No, it's a known (and resolved in later versions) bug in SDL. > Workaround locally by flipping Y or use a later version. My pygame.__version__ reports '1.8.0pre', which suggests to me that this bug fix hasn't made it into the latest Mac binaries. "altern" wrote: > 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 Replacing glOrtho with glOrtho2D produced identical results on all platforms, including the inconsistency on the Mac when windowed. Thanks for the help. -Dave LeCompte > > > > 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] >> Behalf Of Dave LeCompte (really) >> Sent: Tuesday, January 16, 2007 20:20 >> To: pygame-users@seul.org >> 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. >> >
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dave LeCompte (really) Sent: Tuesday, January 16, 2007 20:20 To: pygame-users@seul.org 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.
RE: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
Aha! Thanks for clarifying... After doing so many braintwisting tutorials that required me to move my camera right to make my object go left has left my brain swiss-cheesed :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Alex Holkner Sent: Wednesday, January 17, 2007 09:45 To: pygame-users@seul.org Subject: Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion 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. > > No, it's a known (and resolved in later versions) bug in SDL. Workaround locally by flipping Y or use a later version. Alex. 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.
Re: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
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. No, it's a known (and resolved in later versions) bug in SDL. Workaround locally by flipping Y or use a later version. Alex.
RE: [pygame] MacOS/PyGame/PyOpenGL mouse inversion
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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Dave LeCompte (really) Sent: Tuesday, January 16, 2007 20:20 To: pygame-users@seul.org 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.