From 922f3925446aad51426e7284d25d84b844c6595b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 24 Feb 2016 22:56:47 +0900 Subject: [PATCH] ui: Bug fix: Call glFinish before glfwSwapBuffers to make sure all OpenGL tasks are executed (#161) --- internal/graphics/opengl/context.go | 4 ++++ internal/ui/ui_glfw.go | 3 +++ 2 files changed, 7 insertions(+) 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() })