ui: Bug fix: The default framebuffer must be bound before swapping buffers

This commit is contained in:
Hajime Hoshi 2016-02-28 00:56:39 +09:00
parent 8788c8439f
commit fc200ec6f2
2 changed files with 2 additions and 3 deletions

View File

@ -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{})

2
run.go
View File

@ -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.