dotnet / dotnet/Silk.NET

Silk.NET.OpenGL.Extensions.ImGui: ImGui inputs behave incorrectly with low FramesPerSecond and VSync off when ImGuiController.Update is put in Render loop

Open
#2,502 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C#
Stars
5.2k
Forks
477
Avg merge
3d 16h
Merged PRs (30d)
2

Description

# Summary
ImGuiController behaves incorrectly when put in Render loop of Window, when frame is not drawn due to FPS limit.

Currently noticed issue - Mouse wheel inputs missing.

# Steps to reproduce
https://github.com/dotnet/Silk.NET/blob/main/examples/CSharp/OpenGL%20Demos/ImGui/Program.cs
Windows 11, window options Default with disabled VSync and FramesPerSecond much lower than system can handle.

1. Add `ImGui.ShowDemoWindow();` to open demo window.
2. Start application
3. In demo window, find any place with scroll bar
4. Try scrolling

# Comments
https://github.com/dotnet/Silk.NET/blob/3c0313b2d69bbde12224c759a76bc2e7e064a893/src/Windowing/Silk.NET.Windowing.Common/Internals/ViewImplementationBase.cs#L174

`DoRender` has `if ((delta >= _renderPeriod) || VSync)` which completly skips Render event call. Keyboard and mouse inputs are sent with `ImGuiController.Update(delta)`, not using IInputContext callbackes. This makes some inputs like mouse wheel scroll to not being sent, because they have been sent in the frame which was not drawn.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.