ColorRGBA Alpha

Hi,

I tried to create geometry objects and set the color in this way:

geometryObject.setSolidColor(new ColorRGBA(1,0,0,0.5f));

The object should have to be red and semi.transparent, but I just obtain a red object.

What can I do?

Thanks

Just setting alpha on the color is not enough. Look here : http://www.jmonkeyengine.com/wiki/doku.php?id=adding_textures_and_transparency_to_the_hud

for an example on how to set AlphaState.

I tried this way;

same result  :frowning:



Here's mycode:

AlphaState as = jrr.getDisplay().getRenderer().createAlphaState();

        as.setEnabled(true);

        as.setBlendEnabled(true);

        as.setSrcFunction(AlphaState.SB_SRC_ALPHA);

        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);

      s = new Sphere("Sphere" + x + y + z, new Vector3f(xExtent

/ xSamples * x, yExtent / ySamples * y, zExtent

/ zSamples * z), 4, 4, radius);

      s.setSolidColor(new ColorRGBA(1, 0, 0, 0.5f));

      s.setRenderState(as);

      n.attachChild(s);



Can I do anything else ?

If you use colors instead of materials, you'll need to turn off the lights.  Your settings are fine otherwise.  If you are using SimpleGame, just hit L and see the results.

thanks renanse,

I've been far away from my pc in these days.