Advertisement

Mouse x,y to World x,y

Started by February 20, 2003 02:12 AM
0 comments, last by WildFuse 22 years ago
How can I convert the current mouse x,y from pixels to world space in Ortho view ? My calculations are messed, obv it works if it is a 1 to 1 ratio, that is cursor.x = x cursor.y = SCREEN_HEIGHT - y however this is not realistic as my screen height and perpective height etc.. may never be the same. I was trying to get a ratio of the different sizes cursor.x = x / (SCR_PIXELSX/ORTHO_WIDTH) cursor.y = SCR_PIXELSY - (SCR_PIXELSY/ORTHO_HEIGHT) this does not work either, I want to just move a quad with the same cursor pos for my gui. any ideas ?
gluProject/gluUnproject
does the work for u
PM Times change... Excuse my poor english!

This topic is closed to new replies.

Advertisement