I have used texture draw for 2 images, but the background picture becomes black. The source picture is a png and it’s transparent. How do i solve this?
How do I render out the original image with transparency?
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() if you have disabled it before. Should be enabled by default though.