Disposing a Texture in LibGdx -
i creating single pixel specified color using common method createsinglepixeltexture() have mentioned below.
question: 1. need dispose "singlepixelpixmap" , texture "t" ? 2. if need dispose can dispose ?
singlepixeltexture = createsinglepixeltexture(0.129f, 0.129f, 0.129f, .7f); private texture createsinglepixeltexture(float r,float g,float b,float a) { pixmap singlepixelpixmap; singlepixelpixmap = new pixmap(1, 1, pixmap.format.rgba8888); singlepixelpixmap.setcolor(r, g, b, a); singlepixelpixmap.fill(); pixmaptexturedata texturedata = new pixmaptexturedata(singlepixelpixmap, pixmap.format.rgba8888, false, false, true); texture t = new texture(texturedata); t.setfilter(texturefilter.nearest, texturefilter.nearest); return t; }
- you don't need intermediary
pixmaptexturedata
; it's entirely optional. - as create
texture
pixmap
, can disposepixmap
. can insert disposal of texture beforereturn
. - once dispose
texture
, cannot drawn. not disposet
unless sure never try draw again.
Comments
Post a Comment