handmade.network » Forums » GLFW cursor input lag and OpenGL built-in MSAA
19 posts
#15314 GLFW cursor input lag and OpenGL built-in MSAA
3 months ago Edited by Italo on May 18, 2018, 4:15 a.m. Reason: Initial post

So, I've two unrelated questions, both can be checked in this application if you want to run it and see for yourself: https://github.com/nyeecola/graphs

These are the questions:

1- Am I right in my assessment that the nature of the input lag I experience is that the cursor is software-rendered (via xorg) and the frame is hardware-rendered (via OpenGL)? If so, what I should do is probably render the cursor myself, right?

2- I have a GTX 1050 on my notebook, running on Arch Linux with NVIDIA's proprietary graphics driver (which supports OpenGL 4.6, although I'm only using 3.3 for that project). Why don't I get any multisampling? I specifically asked for 4 samples and get 0 (I checked by doing a gl call later and it returns 0 samples). If I turn on GL_POLYGON_SMOOTH, antialiasing works perfectly, but I don't think that's a good idea, since it means I have to disable the Z-buffer and keep track of the order the objects are drawn.

For question number 2, can someone run it on another computer and check if its a hardware problem on my part or if I am doing something wrong?
Mārtiņš Možeiko
1737 posts / 1 project
#15319 GLFW cursor input lag and OpenGL built-in MSAA
3 months ago Edited by Mārtiņš Možeiko on May 18, 2018, 5:14 a.m.

1. Its actually other way around - if you leave OS to draw mouse cursor, then it is "hardware accelerated". It will have least latency. If you will be drawing yourself with OpenGL, then you will have "software accelerated" cursor, because its position needs to go through your software to get actual coordinates for rendering and it will have larger latency. Latency will come from how OpenGL works.

If by "input lag" you mean that the circles you render lag behind mouse cursor, then this is rendering lag or vsync, not input lag.

2. I get 4 samples on my Arch with 1060M. Here's output I see:

OpenGL version: 3.3.0 NVIDIA 396.24
Samples: 4
Major: 3
Minor: 3

19 posts
#15321 GLFW cursor input lag and OpenGL built-in MSAA
3 months ago

Hi, thanks for the help, here's my follow ups:

1- So, yeah, that's what I mean by input lag. I don't know if this is also because of my hardware, since I tried to disable VSYNC and it didn't get any better. Could you try doing that and see if you get any lag?

2- Hm, thanks, My driver is only a little bit older (390.48), I don't really know what could be causing this.