mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
Reduce calling gl.Flush
This commit is contained in:
parent
52e610845b
commit
f80850ef14
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user