View Full Version : MouseCoords
i use glut for mouse, when i get x,y coords by pressing mouse button and it should place a point in there but it doesn't how can i convert the given coords to screen coords?
The GLUT mouse function returns X and Y coordinates for the click (these are screen coordinates it returns) to convert these to GLUT and consequently openGL coordinates you need to flip the Y axis. Screen coordinates start from the top left, but openGL coordinates start at the _lower_ left corner.
so just do this with the coordinates the mouse down function returns
y = wh - y; // "wh" is the height of your GLUT window.
Hope this helps
Rob The Bloke
07-12-2001, 05:45 PM
Unless of course you want to put that point into 3D space in which case you'll have to use gluUnProject() and some nasty math
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.