First App - No Display?

I got everything to work and run in the first app. The sphere doesnt show though. It seems that the simpleInitGame() method isnt called at all. Any ideas why?



Heres the code:


import com.jme.app.SimpleGame;
import com.jme.scene.shape.Sphere;
import com.jme.bounding.BoundingBox;
import com.jme.math.Vector3f;
import com.jme.scene.state.TextureState;
import com.jme.image.Texture;
import com.jme.util.TextureManager;


public class JMonkeyEngineTest extends SimpleGame{
   
   public static void main(String[] args) {
      System.out.println("Hello Eclipse!");
      JavaMonkeyEngineTest app = new JavaMonkeyEngineTest();
       app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
       System.out.println("After app.diao()");
       app.start();
       System.out.println("After app.start()");
   }
    
   protected void simpleInitGame() {
        System.out.println("In the simple init game method");
        display.setTitle("The Sphere");
       
        Sphere s = new Sphere("Sphere", 30, 30, 25);
        s.setLocalTranslation(new Vector3f(0,0,-50));
        s.setModelBound(new BoundingBox());
        s.updateModelBound();
       
        Texture texture = TextureManager.loadTexture(
                      JMonkeyEngineTest.class.getClassLoader().getResource(
                      "C:/Documents and Settings/Andrew/My Documents/Graphics/Textures/GreenRedCheckersBoard.png"),
                      Texture.MM_LINEAR_LINEAR,
                      Texture.FM_LINEAR);
        TextureState ts = display.getRenderer().createTextureState();
        ts.setEnabled(true);
        ts.setTexture(texture);
      
        s.setRenderState(ts);
      
        rootNode.attachChild(s);
   }
   

}

Yeah, in your main method you create a JavaMonkeyEngineTest object instead of a JMonkeyEngineTest object.


You have created a instance of JavaMonkeyEngineTest instead of JMonkeyEngineTest as per your class name.

I guess you already created a JavaMonkeyEnginTest class in the same package,  otherwise the posted code would'nt even compile.

Using
JMonkeyEngineTest app = new JMonkeyEngineTest();
works fine for me (ie get a sphere).
Stevey

Looks like renanse also replied a few minutes before me, while was posting my response.  V. efficient…

Thank you so much! This is a very helpful forum. :smiley: