diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 71c2d7fb8..358f94828 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -171,6 +171,8 @@ func (u *userInterface) isClosed() bool { } func (u *userInterface) swapBuffers() { + // The bound framebuffer must be the default one (0) before swapping buffers. + u.context.BindZeroFramebuffer() // Call glFinish before glfwSwapBuffer to make sure // all OpenGL tasks are executed. u.context.Finish() @@ -190,7 +192,6 @@ func (u *userInterface) setScreenSize(width, height, scale int) bool { // To make sure the current existing framebuffers are rendered, // swap buffers here before SetSize is called. - u.context.BindZeroFramebuffer() u.swapBuffers() ch := make(chan struct{}) diff --git a/run.go b/run.go index e7c76fee1..4eb97be94 100644 --- a/run.go +++ b/run.go @@ -103,8 +103,6 @@ func Run(f func(*Image) error, width, height, scale int, title string) error { } } gameTime += int64(c) * int64(time.Second/60) - - // Note that the current bound framebuffer must be the default one (0). ui.SwapBuffers() // Calc the current FPS.