libgdxpixmap

Pixmaps and performance-LibGdx


In my game,I am planning to use Pixmap for drawing rectangle.Game logic is based on changing the size,angle,position etc of this rectangle object in a dynamic way. Will Pixmap create any performance issues to the android game when I use it to implement the main game logic?

I have to change the properties of the rectangle object created by the pixmap frequently .Then how it will affect the entire game performance? Do I have to find some other way to implement my requirements?Is it worth using Pixmaps ?

How it will differ if use sprite scale and rotation etc to manipulate image instead of using Pixmap?


Solution

  • According to your requirement As I think you have number of Rectangle. So create number of Sprite because one texture can be shared with number of Sprite.

    Create one Texture and share with all of your Sprite(Rectangular object). Do your required manipulation on Sprite like color, size, rotation, scale.

    And keep in mind :-

    As a Pixmap resides in native heap memory it must be disposed of by calling dispose() when no longer needed to prevent memory leaks.