opengl: Unexport DeleteTexture

This commit is contained in:
Hajime Hoshi 2018-11-04 18:44:41 +09:00
parent 96f1a8aff6
commit 7fbf9f652e
5 changed files with 13 additions and 9 deletions

View File

@ -386,12 +386,7 @@ func (c *disposeCommand) String() string {
// Exec executes the disposeCommand.
func (c *disposeCommand) Exec(indexOffsetInBytes int) error {
if c.target.image.Framebuffer != nil {
c.target.image.Framebuffer.Delete()
}
if c.target.image.Texture != *new(opengl.Texture) {
opengl.GetContext().DeleteTexture(c.target.image.Texture)
}
c.target.image.Delete()
return nil
}

View File

@ -197,7 +197,7 @@ func (c *Context) bindTextureImpl(t Texture) {
})
}
func (c *Context) DeleteTexture(t Texture) {
func (c *Context) deleteTexture(t Texture) {
_ = c.runOnContextThread(func() error {
tt := uint32(t)
if !gl.IsTexture(tt) {

View File

@ -225,7 +225,7 @@ func (c *Context) bindTextureImpl(t Texture) {
gl.Call("bindTexture", texture2d, js.Value(t))
}
func (c *Context) DeleteTexture(t Texture) {
func (c *Context) deleteTexture(t Texture) {
gl := c.gl
if !gl.Call("isTexture", js.Value(t)).Bool() {
return

View File

@ -175,7 +175,7 @@ func (c *Context) bindTextureImpl(t Texture) {
gl.BindTexture(mgl.TEXTURE_2D, mgl.Texture(t))
}
func (c *Context) DeleteTexture(t Texture) {
func (c *Context) deleteTexture(t Texture) {
gl := c.gl
if !gl.IsTexture(mgl.Texture(t)) {
return

View File

@ -35,3 +35,12 @@ func (i *Image) Size() (int, int) {
func (i *Image) IsInvalidated() bool {
return !theContext.isTexture(i.Texture)
}
func (i *Image) Delete() {
if i.Framebuffer != nil {
i.Framebuffer.Delete()
}
if i.Texture != *new(Texture) {
theContext.deleteTexture(i.Texture)
}
}