LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.75k stars 635 forks source link

[MacOS] does not render while resizing #975

Closed mirraj2 closed 5 months ago

mirraj2 commented 5 months ago

Version

3.3.3

Platform

macOS arm64

JDK

JDK 11

Module

GLFW

Bug description

On MacOS, I am dragging the window and it does not render at all until I release the mouse button on the drag. I would like it to keep rendering during the drag operation.

Stacktrace or crash log output

No response

octylFractal commented 5 months ago

This looks like the same issue as https://github.com/glfw/glfw/issues/408 -- is that correct?

mirraj2 commented 5 months ago

that does look similar but not quite the same. In that issue's screenshot I see artifacts during the drag operation but on my computer I see no artifacts.

Also that issue seems to be closed without any kind of fix or solution

octylFractal commented 5 months ago

The solution is described in https://github.com/glfw/glfw/issues/408#issuecomment-68645440 -- use the window refresh callback https://javadoc.lwjgl.org/org/lwjgl/glfw/GLFW.html#glfwSetWindowRefreshCallback(long,org.lwjgl.glfw.GLFWWindowRefreshCallbackI)

Spasi commented 5 months ago

Hey @mirraj2, this can be fixed by decoupling event handling and rendering. Event handling is done on the main thread, with blocking glfwWaitEvents, while rendering is done continuously on a secondary thread.

See the Vorbis sample for example code. It works nicely on Windows too.

mirraj2 commented 5 months ago

thank you both!