Reduce calling gl.Flush

This commit is contained in:
Hajime Hoshi 2015-01-03 16:21:09 +09:00
parent 52e610845b
commit f80850ef14

View File

@ -126,9 +126,14 @@ func (c *Context) NewFramebuffer(texture Texture) (Framebuffer, error) {
return Framebuffer(f), nil
}
var lastFramebuffer Framebuffer
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
gl := c.gl
gl.Flush()
if lastFramebuffer != f {
gl.Flush()
lastFramebuffer = f
}
if f != nil {
gl.BindFramebuffer(gl.FRAMEBUFFER, f)
} else {