[Solved]Objects always white in ORTHO

I'm trying to draw a colored square in ORTHO mode, but for some reason it's always white.  :expressionless:



Anything wrong with the code below ?


public class ColoredSquare extends Quad {

   public ColoredSquare(String name,float width,float height,ColorRGBA color) {
      super(name,width,height);
      
      DisplaySystem display = DisplaySystem.getDisplaySystem();
      
       TextureState ts = display.getRenderer().createTextureState();
      
       this.setRenderQueueMode(Renderer.QUEUE_ORTHO);     
       ts.setEnabled(false);
       this.setRenderState(ts);
      AlphaState as = display.getRenderer().createAlphaState();
      as.setBlendEnabled( false );
      this.setRenderState(as);
      
      LightState ls = display.getRenderer().createLightState();
      ls.setEnabled(false);
      this.setRenderState(ls);
   
      MaterialState ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
      ms.setDiffuse(color);
      ms.setAmbient(color);
      ms.setEmissive(color);
      this.setRenderState(ms);

      this.setLightCombineMode(LightState.OFF);
       this.updateRenderState();
   
   }
}

Solved! :slight_smile:



I need to setDefaultColor



public class ColoredSquare extends Quad {

   public ColoredSquare(String name,float width,float height,ColorRGBA color) {
      super(name,width,height);
     
      DisplaySystem display = DisplaySystem.getDisplaySystem();
      
       this.setRenderQueueMode(Renderer.QUEUE_ORTHO);    

       AlphaState as = display.getRenderer().createAlphaState();
      as.setBlendEnabled( false );
      this.setRenderState(as);
      
      this.setDefaultColor(color);
      this.setLightCombineMode(LightState.OFF);
       this.updateRenderState();
   
   }
}

maybe lighting??

Specular on a quad can be all white, if the light is perpendicular to the plane.

basixs said:

maybe lighting??
Specular on a quad can be all white, if the light is perpendicular to the plane.


Shouldn't this part of the code prevent this ?


      LightState ls = display.getRenderer().createLightState();
      ls.setEnabled(false);
      this.setRenderState(ls);

Sorry, didn't see the disable light state.



Material states need lighting to work, I believe the method you called colors the vertices themselves (but I could be wrong).



Glad its solved :slight_smile: