for some reason my light doesn't work. I press L to see if the light exist at all and it doesn't. my sphere just appears as a solid green color sphere
import com.jme.app.SimpleGame;
import com.jme.scene.shape.Quad;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Sphere;
import com.jme.scene.Node;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.MaterialState;
import com.jme.scene.state.LightState;
import com.jme.math.Vector3f;
import com.jme.util.TextureManager;
import com.jme.image.Texture;
import com.jme.renderer.ColorRGBA;
import com.jme.light.PointLight;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import java.net.URL;
public class BoxDemo extends SimpleGame
{
public static void main(String[] args)
{
BoxDemo app = new BoxDemo(); // Create Object
app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
app.start(); // Start the program
}
protected void simpleInitGame()
{
URL randomTex;
randomTex=BoxDemo.class.
getClassLoader().getResource("grass.png");
TextureState ts=display.getRenderer().createTextureState();
Texture t =
TextureManager.loadTexture(randomTex,
Texture.MM_LINEAR,
Texture.FM_LINEAR);
ts.setTexture(t);
MaterialState ms = display.getRenderer().createMaterialState();
ms.setEmissive(new ColorRGBA(0,0.75f,0,0.5f));
PointLight l=new PointLight();
l.setDiffuse(new ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));
l.setAmbient(new ColorRGBA(0.5f, 0.0f, 0.0f, 1.0f));
//create a point light at position 10,0,0
l.setLocation(new Vector3f(10,0,0));
LightState ls=display.getRenderer().createLightState();
ls.attach(l);
Sphere b = new Sphere("myquad", 10,10,3);
b.setModelBound(new BoundingBox());
b.updateModelBound();
//rootNode.setRenderState(ms);
lightState.detachAll();
rootNode.setRenderState(ls);
rootNode.attachChild(b);
}
}