mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +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
|
return Framebuffer(f), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var lastFramebuffer Framebuffer
|
||||||
|
|
||||||
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
gl.Flush()
|
if lastFramebuffer != f {
|
||||||
|
gl.Flush()
|
||||||
|
lastFramebuffer = f
|
||||||
|
}
|
||||||
if f != nil {
|
if f != nil {
|
||||||
gl.BindFramebuffer(gl.FRAMEBUFFER, f)
|
gl.BindFramebuffer(gl.FRAMEBUFFER, f)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user