Bug 733 - GLWindow.warpPointer() causes slowdowns under Windows
Summary: GLWindow.warpPointer() causes slowdowns under Windows
Status: RESOLVED INVALID
Alias: None
Product: Newt
Classification: JogAmp
Component: core (show other bugs)
Version: 1
Hardware: pc_all windows
: --- normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2013-05-11 18:19 CEST by Julien Gouesse
Modified: 2013-06-12 13:01 CEST (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
jogl 8ff185ef62c832408963f30a2b4875955d7ae650 jogl a446bfbb25397cf5876e766d0bb52cbaaa5f8e2f
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Gouesse 2013-05-11 18:19:42 CEST
When I call GLWindow.warpPointer() to reposition the mouse pointer in the center of the screen, the CPU time consumption of the NEWT thread noticeably increases and the frame rate decreases, it drives my game almost unplayable with a mouse or a touchpad. I have tried to reproduce this behaviour on a simple example:

https://github.com/gouessej/jogl/commit/ce0a9bfa52b20d79547e86a564cede89b90bb744

If you move the cursor during the test, you may notice this slowdown. I'm going to improve it to exhibit the annoying behaviour more obviously.

I have reproduced this bug under Windows 7 64 bits, Java 1.7 update 21, with a Packard Bell Easynote MH 36. This problem doesn't go away when I use a mouse instead of the build-in touchpad even by increasing its sensitivity. However, this bug is not reproducible under Mageia Linux 2 on the same laptop. Performing the same moves with the keyboard doesn't cause such slowdowns.

Another way of reproducing this bug consists in running TUER:
http://tuer.sourceforge.net/very_experimental/tuer.jnlp
Go to "Options" -> "Controls" and tick the checkbox "Never hide the mouse pointer (for debug purpose only)". Go to "Back" -> "Back" -> "Start" -> "Story mode" -> "Performance Test".
Comment 1 Julien Gouesse 2013-05-12 20:38:29 CEST
The frame rate decreases a bit but the main problem comes from the responsiveness of the mouse. NEWT doesn't seem to be responsible for this bug as it works very well with Jake 2, I modified it and tested it with the very latest aggregated build. However, warpPointer() seems to have a different behavior under Windows and Linux.
Comment 2 Julien Gouesse 2013-05-14 09:50:31 CEST
The generated events are not exactly the same under Linux and Windows when moving the mouse manually and with warpPointer(). I'm not sure it was already the case with AWT. I'm still investigating.
Comment 3 Sven Gothel 2013-06-09 09:11:41 CEST
You warp the pointer at every frame, this ofc may bring down rendering,
due to system/WM message overload etc ..

Have a look at the GearsES2 demo:
  <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java;hb=HEAD#l519>

It only warps back to the middle when a mouse event actually has been received
and if that feature is enabled.
Comment 4 Sven Gothel 2013-06-12 12:44:24 CEST
Refined your unit test, demonstrating warp-random at display 
and warp-center at mouseExit.
Comment 5 Julien Gouesse 2013-06-12 13:01:53 CEST
(In reply to comment #3)
> You warp the pointer at every frame, this ofc may bring down rendering,
> due to system/WM message overload etc ..
> 
> Have a look at the GearsES2 demo:
>  
> <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/
> junit/jogl/demos/es2/GearsES2.java;hb=HEAD#l519>
> 
> It only warps back to the middle when a mouse event actually has been
> received
> and if that feature is enabled.

Actually, warping the mouse pointer to the middle when a mouse event has been received is still slow on one of my laptops but the root cause has nothing to do with JOGL 2 and NEWT. When removing and reinstalling some Windows updates, some features become completely broken, it is no more possible to open the file explorer even though the environment variables are correctly set, there are spurious slowdowns in applications. I don't reproduce this bug on other machines under Windows.