opengl: Bug fix: Reset lastTexture when deleting

This commit is contained in:
Hajime Hoshi 2016-07-10 05:04:25 +09:00
parent 69497aff41
commit 1b152ae771
3 changed files with 9 additions and 0 deletions

View File

@ -225,6 +225,9 @@ func (c *Context) DeleteTexture(t Texture) {
if !gl.IsTexture(tt) { if !gl.IsTexture(tt) {
return nil return nil
} }
if c.lastTexture == t {
c.lastTexture = invalidTexture
}
gl.DeleteTextures(1, &tt) gl.DeleteTextures(1, &tt)
return nil return nil
}) })

View File

@ -199,6 +199,9 @@ func (c *Context) DeleteTexture(t Texture) {
if !gl.IsTexture(t.Object) { if !gl.IsTexture(t.Object) {
return return
} }
if c.lastTexture == t {
c.lastTexture = invalidTexture
}
gl.DeleteTexture(t.Object) gl.DeleteTexture(t.Object)
} }

View File

@ -173,6 +173,9 @@ func (c *Context) DeleteTexture(t Texture) {
if !gl.IsTexture(mgl.Texture(t)) { if !gl.IsTexture(mgl.Texture(t)) {
return return
} }
if c.lastTexture == t {
c.lastTexture = invalidTexture
}
gl.DeleteTexture(mgl.Texture(t)) gl.DeleteTexture(mgl.Texture(t))
} }