ui: Bug fix: Make sure current framebuffers rendered (#158)

This commit is contained in:
Hajime Hoshi 2016-02-22 03:14:31 +09:00
parent 18a798f85c
commit 9e161864f6
3 changed files with 10 additions and 0 deletions

View File

@ -156,6 +156,10 @@ func (c *Context) TexSubImage2D(p []uint8, width, height int) {
gl.TexSubImage2D(mgl.TEXTURE_2D, 0, 0, 0, width, height, mgl.RGBA, mgl.UNSIGNED_BYTE, p)
}
func (c *Context) BindZeroFramebuffer() {
gl.BindFramebuffer(mgl.FRAMEBUFFER, mgl.Framebuffer(ZeroFramebuffer))
}
func (c *Context) NewFramebuffer(texture Texture) (Framebuffer, error) {
f := gl.CreateFramebuffer()
gl.BindFramebuffer(mgl.FRAMEBUFFER, f)

View File

@ -157,6 +157,11 @@ func (u *userInterface) setScreenSize(width, height, scale int) bool {
return false
}
// To make sure the current existing framebuffers are rendered,
// swap buffers here.
u.context.BindZeroFramebuffer()
u.swapBuffers()
ch := make(chan struct{})
window := u.window
window.SetFramebufferSizeCallback(func(w *glfw.Window, width, height int) {

1
run.go
View File

@ -114,6 +114,7 @@ func Run(f func(*Image) error, width, height, scale int, title string) error {
return err
}
// Note that the current bound framebuffer must be the default one (0).
ui.SwapBuffers()
// Calc the current FPS.