Troubles with colors

Hello, i've got  a problem with render state

I ve got 5 SimpleDiceUI object in the scene and only the second one should be animate with a red light on it but the others are also in red except the first.

Here is my test object

package bombastic;

import java.util.logging.Level;
import bombastic.jme.SimpleDiceUI;
import com.jme.util.LoggingSystem;

public class Test extends SimpleGame
   SimpleDiceUI[] dices=new SimpleDiceUI[5];

   public static void main(String[] args)
      Test app = new Test();

   protected void simpleInitGame()
      for (int i=0;i<dices.length;i++)
         dices[i] = new SimpleDiceUI(rootNode,2*i,0);


   protected void simpleUpdate()

and here is my DiceUIObject

package bombastic.jme;


import com.jme.image.Texture;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.RenderState;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;
import com.jmex.model.XMLparser.JmeBinaryReader;
import com.jmex.model.XMLparser.Converters.MilkToJme;

public class SimpleDiceUI
   private static int id;

   //UI Data
   private Node _boardRootNode;
   private Node _objRoot;
   private Node _diceModel;
   private int _initial_x;
   private int _initial_y;
   private boolean _blinkInitialised=false;
   private boolean _isInitialised=false;
   private boolean _lighted=false;
   private int _spendTime;
   private int _firstBlinkTime;
   private Box _blinkedBox=null;
   public SimpleDiceUI(Node rootNode,int x,int y)
      _objRoot = new Node("DiceUI_"+id++);
   public void init(float time)
      if (!_isInitialised)
         _diceModel = loadDiceModel();
         _objRoot.setLocalTranslation(new Vector3f(_initial_x,_initial_y,1));

   private Node loadDiceModel()
      Node diceNode=null;

      // Load Dice Model
      MilkToJme converter=new MilkToJme();
      ByteArrayOutputStream BO=new ByteArrayOutputStream();   
      URL textu=DiceUI.class.getClassLoader().getResource("models/dice.bmp");
      URL diceModel=DiceUI.class.getClassLoader().getResource("models/dice.ms3d");
      } catch (IOException e) {
         System.out.println("damn exceptions:" + e.getMessage());
      JmeBinaryReader jbr=new JmeBinaryReader();
         diceNode=jbr.loadBinaryFormat(new ByteArrayInputStream(BO.toByteArray()));
      } catch (IOException e) {
         System.out.println("damn exceptions:" + e.getMessage());
      // create texture
      TextureState ts =
      Texture texture =


      return diceNode;      

   private void prepareBlinkEffect(Node node)
      _blinkedBox = new Box("RedBox", new Vector3f(0, 0, 0), .5f, .5f, .5f);
      _blinkedBox.setSolidColor(new ColorRGBA(0.8f, 0.5f, 0.5f, 0.5f));

      AlphaState as =   DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();

   public void blink(float time)
      boolean change = false;
      int life = 200;
         // initialise blink
         _spendTime =0;
         change =true;
         // make the color box appears
         _spendTime = (int)System.currentTimeMillis()- _firstBlinkTime;
      if(life < _spendTime)
         _spendTime = 0;

         if (!_lighted)

Can somebody help me ? I'm becoming mad !!!

Define a render state for the other spatials (e.g. in the rootNode) of the same kind you are using for blinking (alpha in this case). OpenGL uses the last renderstate if no new renderstate (of a special kind) is set to draw an object.

Thanks for your quick response, it works fine now.  :wink: