Alpha?

I saw some tutorials using alpha on JMEPhysics tutorials.



But those use deprecated methods.



I have this:



                    final AlphaState alphaState = display.getRenderer().createAlphaState();
                    alphaState.setEnabled( true );
                    alphaState.setBlendEnabled( true );
                    alphaState.setSrcFunction( AlphaState.SB_SRC_ALPHA );
                    alphaState.setDstFunction( AlphaState.DB_ONE_MINUS_SRC_ALPHA );
                    spatial.setRenderState( alphaState );
                    spatial.setRenderQueueMode( Renderer.QUEUE_TRANSPARENT );



And i tried to figure out how should i change it to make it work.

I dont really know if i should use blendState or what.. it works, but... not very good.

                   final BlendState blendState = display.getRenderer().createBlendState();
                    blendState.setEnabled(true);
                    blendState.setBlendEnabled(true);
                    blendState.setSourceFunctionAlpha( blendState.getSourceFunctionAlpha().SourceAlpha );
                    blendState.setDestinationFunctionAlpha( blendState.getDestinationFunctionAlpha().OneMinusSourceAlpha);
                    spatial.setRenderState( blendState );
                    spatial.setRenderQueueMode( Renderer.QUEUE_TRANSPARENT );




Any ideas? is it ok or not? anywhere i could see alpha examples for jme2?

Actually that's a good port from jME1 to jME2, however for src/dst functions, use this:

blendState.setSourceFunction( BlendState.SourceFunction.SourceAlpha );
            blendState.setDestinationFunction( BlendState.DestinationFunction.OneMinusSourceAlpha );


I thought that there was a publically available jME-physics dist for jME2? If it's not the case then perhaps one should be made?

There is also a page on the wiki that details many of the changes from JME1 to JME2 here -

http://www.jmonkeyengine.com/wiki/doku.php?id=jme_to_jme2_changes



Always worth checking there when working with tutorials that don’t compile properly as most of the common differences are there.

Momoko_Fan said:

Actually that's a good port from jME1 to jME2, however for src/dst functions, use this:

blendState.setSourceFunction( BlendState.SourceFunction.SourceAlpha );
            blendState.setDestinationFunction( BlendState.DestinationFunction.OneMinusSourceAlpha );


I thought that there was a publically available jME-physics dist for jME2? If it's not the case then perhaps one should be made?



haha! really?  :D

That
I thought that there was a publically available jME-physics dist for jME2?

Its under http://jmephysics.googlecode.com/svn/

I see… Just that I had issues about 2 weeks ago while checking out jME-physics from there, so I grabbed the latest dist zip and apparently that one was for jME1 so I had to do the porting manually.