diff --git a/internal/graphics/opengl/context.go b/internal/graphics/opengl/context.go index ec2eee1f1..78049c6d3 100644 --- a/internal/graphics/opengl/context.go +++ b/internal/graphics/opengl/context.go @@ -336,3 +336,7 @@ func (c *Context) BufferSubData(bufferType BufferType, data []int16) { func (c *Context) DrawElements(mode Mode, len int) { gl.DrawElements(mgl.Enum(mode), len, mgl.UNSIGNED_SHORT, 0) } + +func (c *Context) Finish() { + gl.Finish() +} diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 663edf998..55b8381c0 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -147,6 +147,9 @@ func (u *userInterface) isClosed() bool { } func (u *userInterface) swapBuffers() { + // Call glFinish before glfwSwapBuffer to make sure + // all OpenGL tasks are executed. + u.context.Finish() u.context.RunOnContextThread(func() { u.window.SwapBuffers() })