LWJGL Forum

Programming => Bug Reports / RFE => Topic started by: Obsyd on April 18, 2016, 20:29:38

Title: OSX window control buttons and mouse leaving window
Post by: Obsyd on April 18, 2016, 20:29:38
Hello there!

I have been testing the latest "build 72" version of lwjgl 3.0. Fired up the "Getting started" example code and measured the time spent between the glClear,glfwSwapBuffers,glfwPollEvents. As expected nice semi consistent 16ms loop because of enabled vsync on a 60hz monitor.

Now, my problem is that when the cursor leaves the window I get noticeable loop time variations.
When the cursor leaves the window the loop sometimes finises in 14ms sometimes 20. (not that bad)
But when I hover around the window control buttons (red,yellow and green OSX window buttons) the loop time fluctuates excessively. Sometimes 0ms to 55ms.
It gets even more excessive if the cursor leaves the window and enters again while hovering above the window control buttons.

At first I thought my IDE was causing the troubles so I made a jar and quit every other application. Ran the jar from the terminal but no change.
Also tried to control the loop with a hungry sync that burns cpu cycles. This got the loop extremely precise but when the cursor leaves the window and interacts with the window control buttons the same fluctuation happens.

Thank you for your help!

My system:
OSX 10.10.3
i7 4770 cpu
AMD 7970 gpu


Title: Re: OSX window control buttons and mouse leaving window
Post by: spasi on April 21, 2016, 21:55:44
I cannot reproduce this on OSX 10.11.4, Intel Iris 6100. Could you share a short code sample that reproduces the issue please?
Title: Re: OSX window control buttons and mouse leaving window
Post by: Obsyd on April 22, 2016, 10:54:08
Made a small video:
https://www.youtube.com/watch?v=l1k0FtxYa8U

The only change in the "Getting started" code:
Code: [Select]
while (!glfwWindowShouldClose(window)) {
            long s = System.nanoTime();
            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer

            glfwSwapBuffers(window); // swap the color buffers

            // Poll for window events. The key callback above will only be
            // invoked during this call.
            glfwPollEvents();
            long e = System.nanoTime();
            System.out.println((e - s) / 1000000d);
        }
Title: Re: OSX window control buttons and mouse leaving window
Post by: spasi on April 22, 2016, 11:01:28
Highest value I see locally is ~18.5ms.
Title: Re: OSX window control buttons and mouse leaving window
Post by: Obsyd on April 22, 2016, 11:03:33
A part of the output:

16.2936
17.115284
16.417982
16.855391
50.01605
0.226693
16.671909
16.011766
16.758341
16.696481
16.499978
16.472038
Title: Re: OSX window control buttons and mouse leaving window
Post by: spasi on April 22, 2016, 11:05:53
I wouldn't worry about it. It's either a driver problem or an issue with the OS X compositor.
Title: Re: OSX window control buttons and mouse leaving window
Post by: Obsyd on April 22, 2016, 11:07:16
Ok! Thank you!

What I will do later is test on different operating systems. Will report back!
Title: Re: OSX window control buttons and mouse leaving window
Post by: Obsyd on May 06, 2016, 15:38:48
Tested it on windows 8.1 and there are no problems there. It is weird that lwjgl 2 does not show such behaviour on osx. (probably not so weird because all of lwjgl has changed)

Also on the windows 8.1 machine I tested the loop was extremely inconsistent with glfwSwapInterval(1);. It has an integrated inteh hd 4600 gpu. With glfwSwapInterval(0); the loop was smooth again.