Just another BEGINNER frustration - coordinates - again! (Went?)

The good news is that I am making progress, the bad news…
I am “back-paddling” to rebuild what I have so far to ALWAYS utilize
“normalized device coordinates”.
Ya know, limit floats to between -1 and +1;
Not even sure if that is an official term, but it has been working so far…

So I decided to add mouse processing.
First thing I run into is
glutMouseFunc ( *void( callback )( int button , int state , int x , int y ) );

The "coordinates " are “int” and according to one “resource” int x = 0, int y = 0 refer to UPPER LEFT corner of the “window” in pixels!
So much for “normalized device coordinates”.
Happy coding…

@JulyJim GLUT is obsolete for 20 years at least. Happy coding.

Really, try using something less ancient, like GLFW.

The actual reason is that these normalized device coordinates are used in the viewport, which you can place anywhere in the window, and even move several times per frame (using glViewport). OTOH, input coordinates are used in the whole window regardless of the viewports you use (and may be used for many things besides OpenGL), so these are in window coordinates.

P.S. In the fragment shader you have gl_FragCoord which is in window coordinates as well, but that’s another story.

Yes, but FreeGLUT is still being maintained. I mean sure, it’s not the best tool in the world, but it gets the job done.

duh,that is why I am sticking with them - works just fine for me…

…and off we go into another subject …
Happy coding