javacolorslibgdxspritebatch

libGDX: How to disable the color on SpriteBatch?


With some assets, I'm trying to implement is so that I have a grayscale image, and use the Batch#setColor method to paint over it programmatically.

However, can Batch#setColor be disabled afterwards for rendering of the rest of the assets? I only want certain assets to render with the colored overlaid, not everything else as well.

I'm failing to see how to disable it, but I assume there must be a way?


Solution

  • The batch's set color is multiplied by the color of the sprite, so to "disable" it, set it to white.

    batch.setColor(Color.WHITE);