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;  } 

  1. you don't need intermediary pixmaptexturedata; it's entirely optional.
  2. as create texture pixmap, can dispose pixmap. can insert disposal of texture before return.
  3. once dispose texture, cannot drawn. not dispose t unless sure never try draw again.

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -