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
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