Hi everyone, I’m a bit confused about OGL coordinates.
I read that the origin in OGL is in the bottom left corner, but when I draw a vertex in 0,0,0 position the vertex is in the center of my window.
Is it correct?
That’s important because I need to retrive mouse position when clicking the left button, I use GLUT method and the 0 position is in the top left corner, and so it’s difficoult “normalize” mouse coordinates with OGL coordinates.
No, no, no. Window coordinates begin in the lower left corner of the window.
The world space position (0, 0, 0) is mapped to the center of the screen, if your camera model features a symmetric or aspect ratio corrected frustum, is not situated itself at the origin, and has its clipping planes set accordingly.
OpenGL has nothing to do with retrieving the position of the mouse pointer in the active window. That’s the job of the windowing toolkit and your OS’s window server.
and how can I recognize when the mouse is clicked on a shape drawed on screen? I don’t know the window coordinates of the shapes (eg a rectangle)