LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: abcdef on January 31, 2015, 17:35:12

Title: [BUG] LWJGL3 Bug (might be GLFW bug) - Screen coordinates vs Mouse coordinates
Post by: abcdef on January 31, 2015, 17:35:12
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.
Title: Re: LWJGL Bug (might be GLFW bug) - Screen coordinates vs Mouse coordinates
Post by: kappa on January 31, 2015, 17:38:27
Which OS you on?
Title: Re: LWJGL Bug (might be GLFW bug) - Screen coordinates vs Mouse coordinates
Post by: abcdef on January 31, 2015, 18:31:39
Testing on Linux currently
Title: Re: LWJGL Bug (might be GLFW bug) - Screen coordinates vs Mouse coordinates
Post by: abcdef on February 03, 2015, 06:19:27
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)
Title: Re: LWJGL Bug (might be GLFW bug) - Screen coordinates vs Mouse coordinates
Post by: EpicTaco on February 03, 2015, 22:39:25
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).
Title: Re: [BUG] LWJGL3 Bug (might be GLFW bug) - Screen coordinates vs Mouse coordinates
Post by: abcdef on February 04, 2015, 05:45:31
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.