mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
opengl: Reduce CheckFramebufferState call for speed
This commit is contained in:
parent
91491e58f4
commit
16ef82fa23
@ -231,12 +231,6 @@ func (c *Context) NewFramebuffer(texture Texture) (Framebuffer, error) {
|
||||
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
||||
return c.RunOnContextThread(func() error {
|
||||
c.bindFramebuffer(f)
|
||||
if st := gl.CheckFramebufferStatus(gl.FRAMEBUFFER); st != gl.FRAMEBUFFER_COMPLETE {
|
||||
if e := gl.GetError(); e != 0 {
|
||||
return fmt.Errorf("opengl: glBindFramebuffer failed: %d", e)
|
||||
}
|
||||
return errors.New("opengl: glBindFramebuffer failed: the context is different?")
|
||||
}
|
||||
gl.Viewport(0, 0, int32(width), int32(height))
|
||||
return nil
|
||||
})
|
||||
|
@ -186,12 +186,6 @@ func (c *Context) NewFramebuffer(texture Texture) (Framebuffer, error) {
|
||||
func (c *Context) SetViewport(f Framebuffer, width, height int) error {
|
||||
gl := c.gl
|
||||
c.bindFramebuffer(f)
|
||||
if err := gl.CheckFramebufferStatus(mgl.FRAMEBUFFER); err != mgl.FRAMEBUFFER_COMPLETE {
|
||||
if e := gl.GetError(); e != 0 {
|
||||
return fmt.Errorf("opengl: glBindFramebuffer failed: %d", e)
|
||||
}
|
||||
return errors.New("opengl: glBindFramebuffer failed: the context is different?")
|
||||
}
|
||||
gl.Viewport(0, 0, width, height)
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user