[BUG] LWJGL3 Bug (might be GLFW bug) - Screen coordinates vs Mouse coordinates

Started by abcdef, January 31, 2015, 17:35:12

Previous topic - Next topic

abcdef

Hi

When I set the resolution to be windowed and to be the size of my desktop resolution I get a mismatch of the x,y I draw to vs the x,y returned by the cursor callback. I don't get this issue when I use any other desktop resolution that is smaller than by desktop resolution. Example if I draw square with bottom left 100,100 and put my mouse cursor at the bottom left I will not get 100,100. The projection matrix logic is the same for all resolutions so I don't think its that (as it works on other resolutions)

This could very well be a GLFW but thought i would raise here first.

kappa


abcdef


abcdef

This should probably be moved in to the bug section, I was wondering if a mod could move it? (just realised it is in the wrong place)

EpicTaco

GLFW uses the direct window coordinates for the cursor callback, whereas your glOrtho might not have been updated to handle the resolution change in your OpenGL context. I'd personally not recommend even using direct screen coordinates with glOrtho (although most tutorials do this).

abcdef

The resolution change is not the issue (I don't believe). I can switch quite happily to any number of windowed resolutions and they all work, apart from the windowed resolution that equals my screen resolution. When on the bad resolution and switch again to another everything aligns up again. My code handles the new matrix calculation after each change, objects are recreated ok etc.