6

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

i tried loading the picture and replacing the palete's first color with 0x00000000. however since the pixels are either opaque or transparent i dont need alpha values so i could save a lot of memory by using RGB888 instead of RGBA8888. i lookes through the gdx and opengl documentary for other blending options and found Gdx.gl20.glBlendColor and the SpriteBatch's setBlendFunction function. but they only change the values used in the blending equations.

thanks in advance :)

4

1 回答 1

3

要透明地绘制纹理区域,请使用如下例程:

    Color c = batch.getColor();
    batch.setColor(1, 1, 1, alpha);
    batch.draw(....);
    batch.setColor(c);
于 2012-04-28T08:53:41.863 回答