2枚の画像にテクスチャ描画を使用しましたが、背景画像が黒くなります。ソース画像はpngで、透明です。どうすればこれを解決できますか?
元の画像を透明にレンダリングするにはどうすればよいですか?
これを試して:
spriteBatch.begin();
//background
seaTexture = new Texture(px);
Color c = spriteBatch.getColor();
spriteBatch.setColor(c.r, c.g, c.b, 1f); //set alpha to 1
spriteBatch.draw(seaTexture, 0, 0, 480, 320);
//foreground
c = spriteBatch.getColor();
spriteBatch.setColor(c.r, c.g, c.b, .3f);//set alpha to 0.3
spriteBatch.draw(blockTexture, 50, 100, 120, 120);
spriteBatch.end();
spritebatch.enableBlending()
以前に無効にしたことがある場合は試してください。ただし、デフォルトで有効にする必要があります。