Hello Guest

LWJGL 2.9.3 getY() for mouse events seems broken when using canvas

  • 4 Replies
  • 6844 Views
Windows 7

Just upgraded from 2.8.2 to 2.9.3 and I noticed that when running LWJGL with a AWT-canvas the mouse
events always reports 0 for getY() - getX() works fine though. getEventY() doesn't work either - but you will get data if you use getEventDY();
« Last Edit: February 16, 2015, 21:38:39 by laserlars »

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
« Reply #1 on: February 18, 2015, 12:10:37 »
I cannot reproduce this. Could you post more information or some code? What does your event loop look like? Do you use mouse grabbing?

Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
« Reply #2 on: February 24, 2015, 07:19:24 »
@laserlars check out http://forum.lwjgl.org/index.php?topic=5471.0 2.9.3 contained a fix for mouse movements. Make sure your mouse reading is looping over all events.

@spasi please correct me on this, but if you use mouse grabbing you are safe to just make the collect call, i.e. getX(), but if you don't use grabbing its your responsibility to collect all input data via event loop, i.e. [LOOP]x += getEventX()[/LOOP]?

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
« Reply #3 on: February 24, 2015, 12:02:35 »
@spasi please correct me on this, but if you use mouse grabbing you are safe to just make the collect call, i.e. getX(), but if you don't use grabbing its your responsibility to collect all input data via event loop, i.e. [LOOP]x += getEventX()[/LOOP]?

The difference is not related to mouse grabbing. Methods like getX() are just aggregates of the events that have occurred since the last time they were called. An event loop simply gives you the "history" of how you got there.

Re: LWJGL 2.9.3 getY() for mouse events seems broken when using canvas
« Reply #4 on: February 25, 2015, 11:05:19 »
Hi! Sorry for slow reply!

I threw out the code and switched to plain awt graphics 2d as I didn't really do any fancy stuff with GL anyway (just basic 2d) but I'm thinking of rendering again with GL.

I will check my git If I can roll-back. But It was really basic - and what suprised me was the fact that X worked fine but not Y. I will investigate when I get home from work!