mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
opengl: Unexport DeleteTexture
This commit is contained in:
parent
96f1a8aff6
commit
7fbf9f652e
@ -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
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user