mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
opengl: Bug fix: Reset the bound framebuffer after deletion (#227)
This commit is contained in:
parent
56844100c2
commit
da1354ec51
@ -38,8 +38,8 @@ type Context struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) bindFramebuffer(f Framebuffer) {
|
func (c *Context) bindFramebuffer(f Framebuffer) {
|
||||||
// TODO: This is a temporal hack to pass the tests.
|
if c.lastFramebuffer != f {
|
||||||
// Fix the bug (#227).
|
c.bindFramebufferImpl(f)
|
||||||
c.bindFramebufferImpl(f)
|
c.lastFramebuffer = f
|
||||||
c.lastFramebuffer = f
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,6 +247,12 @@ func (c *Context) FillFramebuffer(r, g, b, a float64) error {
|
|||||||
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
||||||
c.RunOnContextThread(func() error {
|
c.RunOnContextThread(func() error {
|
||||||
ff := uint32(f)
|
ff := uint32(f)
|
||||||
|
// If a framebuffer to be delted is bound, a newly bound framebuffer
|
||||||
|
// will be a default framebuffer.
|
||||||
|
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glDeleteFramebuffers.xml
|
||||||
|
if c.lastFramebuffer == f {
|
||||||
|
c.lastFramebuffer = ZeroFramebuffer
|
||||||
|
}
|
||||||
gl.DeleteFramebuffers(1, &ff)
|
gl.DeleteFramebuffers(1, &ff)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -223,6 +223,12 @@ func (c *Context) FillFramebuffer(r, g, b, a float64) error {
|
|||||||
|
|
||||||
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
|
// If a framebuffer to be delted is bound, a newly bound framebuffer
|
||||||
|
// will be a default framebuffer.
|
||||||
|
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glDeleteFramebuffers.xml
|
||||||
|
if c.lastFramebuffer == f {
|
||||||
|
c.lastFramebuffer = ZeroFramebuffer
|
||||||
|
}
|
||||||
gl.DeleteFramebuffer(f.Object)
|
gl.DeleteFramebuffer(f.Object)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +199,12 @@ func (c *Context) FillFramebuffer(r, g, b, a float64) error {
|
|||||||
|
|
||||||
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
func (c *Context) DeleteFramebuffer(f Framebuffer) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
|
// If a framebuffer to be delted is bound, a newly bound framebuffer
|
||||||
|
// will be a default framebuffer.
|
||||||
|
// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glDeleteFramebuffers.xml
|
||||||
|
if c.lastFramebuffer == f {
|
||||||
|
c.lastFramebuffer = ZeroFramebuffer
|
||||||
|
}
|
||||||
gl.DeleteFramebuffer(mgl.Framebuffer(f))
|
gl.DeleteFramebuffer(mgl.Framebuffer(f))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user