hi,there.
I want to place something into an transparent cylinder. But I can't see what I placed outside the cylinder.How to make them visable?
here is the code.
AlphaState as1 = display.getRenderer().createAlphaState();
as1.setBlendEnabled(true);
as1.setSrcFunction(AlphaState.SB_SRC_ALPHA);
as1.setDstFunction(AlphaState.DB_ONE);
Cylinder cylinder = new Cylinder("cylinder1",15,15,1.0,10);
cylinder.setRenderState(as1); //make the cylinder transparent
Cylinder c2 = new Cylinder("c2", 15, 15,0.2f,10);
rootNode.attachChild(cylinder);
rootNode.attachChild(c2);
The code you posted will not make the cylinder transparent by itself, you'll also need to apply a material state with a diffuse color that has an ambient less than 1 (like .5f)
renanse:
The Magic Word of the Day is render queues
http://www.jmonkeyengine.com/jmeforum/index.php?topic=2954.0
Right, can you post a more complete test so we can all be on the same page?
I got it.
thanks
… and what do you do when an ortho (HUD) element needs to be transparent?
Normal object are drawn into a z buffer. With ortho there is no z-buffer (afaik). So, transparancy is not a problem. The second object is just drawn on top of the first, the third on top of the second and first, etc.
if you have a mixture of opaque and transparent, change the z order of the transparent ortho items so they draw after the opaque. Other than that, as llama said, there isn't a whole lot to worry about.