LibGDX: handle the first color in the palette as a transparent color

old game engines designate the first color of the image palette as a transparent color. Is there a way to do the same with libGDX?

I tried to load the image and replaced the first pallet color with 0x00000000. however, since the pixels are either opaque or transparent, I don't need alpha values, so I could save a lot of memory by using RGB888 instead of RGBA8888. I am looking through the gdx and opengl documentation for other mixing options and have discovered the Gdx.gl20.glBlendColor function and the SpriteBatch setBlendFunction function. but they only change the values ​​used in the mixing equations.

early:)

+6
source share
1 answer

To draw a Region texture transparently, use this procedure as follows:

Color c = batch.getColor(); batch.setColor(1, 1, 1, alpha); batch.draw(....); batch.setColor(c); 
+3
source

Source: https://habr.com/ru/post/912788/


All Articles