Applyng texture with alpha/transparency

How do I apply an image containing alpha information to an object? (png, gif or tga)

When i try to do it now the transparent part becomes black…

you need to add a blendstate to the spatial as well…

also make sure you set the renderqueue mode to transparent…

My game code is:



DisplaySystem display = DisplaySystem.getDisplaySystem();
BlendState bs = display.getRenderer().createBlendState();
bs.setBlendEnabled(true);
bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha );
bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);

Quad quad = new Quad(name, width, height);     
final TextureState ts = display.getRenderer().createTextureState();
ts.setTexture(t);

quad.setRenderState(ts);
quad.setRenderState(bs);
quad.updateRenderState()




Im NOOT using the RenderQueue method and the texture alpha run FINE :S
Im NOOT using the RenderQueue method and the texture alpha run FINE :S

It's not a seperate method, you're supposed to use it with the BlendState. Try adding some more objects and a background to your game and then you'll see why you need the Render Queue thing..

im using renderqueue method but for Ortho

Queues:


  • Opaque - Everything is rendered in a FIFO fashion

  • Transparent - Prior to rendering, queue is shuffled so that closer objects are rendered last

  • Ortho - Rendered after the ALL other queues, objects are rendered in a FIFO fashion