We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › world and screen coordinates
Page Index Toggle Pages: 1
world and screen coordinates (Read 873 times)
world and screen coordinates
Sep 30th, 2007, 3:40pm
 
Is there an way to get the "world" coordinates from screen coordinates?
After many changes (translations, scalings, rotations) in the transformations matrix, I'd like to point with the mouse on a location on the screen. Instead of the screen coordinates I need to have world coordinates.
Adi
Re: world and screen coordinates
Reply #1 - Sep 30th, 2007, 3:46pm
 
have you tried screenX(), ..?

http://processing.org/reference/screenX_.html

F
Re: world and screen coordinates
Reply #2 - Sep 30th, 2007, 3:57pm
 
I think I need the reverse of screenX. With mouseX a have the screen coordinate, but I don't know where this is in my world (which is projected on the screen).
Re: world and screen coordinates
Reply #3 - Sep 30th, 2007, 4:39pm
 
If you're using OpenGL I wrote a function a while back that'll do what you want:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1176483247
Re: world and screen coordinates
Reply #4 - Sep 30th, 2007, 5:33pm
 
Thank you John! I integrated the OpenGL and it works perfectly! I thought that this could be a silly question, but your answer shows me that the problem is not so trivial.
Page Index Toggle Pages: 1