JmeDestop not works anymore (but did before)

Hi, well I guess I'm as always just not seeing something very basic, however, here is my Problem:

My program is so far a modified copy paste from the TestJmeDestop example.



It displayed the Swing stuff correctly, and even the Input i got to work as it should, however for some reason my Swing stuff now is not shown anymore at all, not even an error.



Here is my code:



   protected void initGame() {
      try{
         display.getRenderer().setBackgroundColor( ColorRGBA.black.clone() );
         rootNode = new Node("rootNode");
          ZBufferState buf = display.getRenderer().createZBufferState();
          buf.setEnabled(true);
          buf.setFunction(ZBufferState.CF_LEQUAL);
          rootNode.setRenderState(buf);
          rootNode.setCullMode( SceneElement.CULL_NEVER );
          Hudnode = new Node( "desktop node" );
           rootNode.attachChild( Hudnode );
           Hudnode.setRenderQueueMode( Renderer.QUEUE_ORTHO );
         UIManager.setLookAndFeel( new MetalLookAndFeel() );
          JMEDesktop jmeDesktop = new JMEDesktop("SwingDestop");
           jmeDesktop.setup( display.getWidth(), display.getHeight(), false, input );
           jmeDesktop.setLightCombineMode( LightState.OFF );
          jmeDesktop.setLightCombineMode( LightState.OFF );
          Hudnode.attachChild( jmeDesktop );
          desktopPane = jmeDesktop.getJDesktop();
          final JInternalFrame internalFrame = new JInternalFrame("Wayne");
           internalFrame.setLocation(display.getWidth()/2,display.getHeight()/2);
           internalFrame.setResizable( false );
           internalFrame.getContentPane().setLayout( new FlowLayout() );
           internalFrame.getContentPane().add(new JButton("lol"));
           internalFrame.setVisible( true );
           internalFrame.pack();
           internalFrame.grabFocus();
           desktopPane.add( internalFrame );
          rootNode.updateRenderState();
      }
      catch(Exception e){
         e.printStackTrace();
      }
   }


protected void initSystem() {
        try {
           display = DisplaySystem.getDisplaySystem(properties.getRenderer());
           display.setTitle("New Horizons");
           display.createWindow(properties.getWidth(),properties.getHeight(),properties.getDepth(),properties.getFreq(),properties.getFullscreen());
           //Save screen size for later use!
           display.setVSyncEnabled(true); //we really don't need more frames than we can display!
           cam = display.getRenderer().createCamera(display.getWidth(),display.getHeight());
           cam.setFrustumPerspective(45.0f,(float) display.getWidth()/(float)display.getHeight(),1,1000);
           Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
           Vector3f left = new Vector3f( -1.0f, 0.0f, 0.0f);
           Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
           Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
           cam.setFrame(loc, left, up, dir);
           cam.update();
           display.getRenderer().setCamera(cam);
           FirstPersonHandler firstPersonHandler = new FirstPersonHandler(cam,50,1);
           input = firstPersonHandler;
          timer = Timer.getTimer();
         }
       
         catch (JmeException e) {
             Console.println(e.toString());
         }
   }

   @Override
   protected void render(float interpolation) {
      display.getRenderer().clearStatistics();
       display.getRenderer().clearBuffers();
       display.getRenderer().draw(rootNode);
   }

   @Override
   protected void update(float interpolation) {
      timer.update();
      tpf = timer.getTimePerFrame();
      input.update( tpf );
      rootNode.updateGeometricState(tpf, true);
   }



The whole thing extends VariableTimestepGame.

Any help would be really nice.

Howdy, want to help us help you?



If you submit tests that are complete (one file w/ main method) all someone has to do is copy/paste and run it; the way you have it now I need to recreate the jME environment, which I would just use SimpleGame and thus possibly invalidate your test.

Here it is then:



Client.java


public class Client {

   /**
    * @param args
    */
   public static void main(String[] args) {
      Loader.AddtoPrecache ("textures/cursor/cursor normal.png","normalCursor",Loader.TextureState);
   //   Loader.AddtoPrecache ("c:/miau.3ds","spam",Loader.UnanimatedModel);
      try{
         EngineBase game = new EngineBase();
         game.setDialogBehaviour(2);
         game.start();
      }
      catch(Exception e){
         Console.println(e.toString());
      }
      
   }
}



Console.java


import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

public class Console extends JInternalFrame{
   private static final long serialVersionUID = 1L;
   static Console myself = null;
   static DefaultListModel content;
   public JTextField input;
   public JScrollPane scroller;
   private Console(){
      myself = this;
      setSize( 300, 200 );
      setTitle("Console");
      setDefaultCloseOperation(HIDE_ON_CLOSE);
      setLayout( new BorderLayout(5, 5) );
      JButton save = new JButton("Save Console Dump");
      add(save,BorderLayout.PAGE_START );
      content = new DefaultListModel();
      JList console = new JList(content);
      scroller = new JScrollPane(console);
      scroller.setAlignmentY(100);
      add(scroller);
      input = new JTextField();
      
      input.addActionListener( new ActionListener() {
         public void actionPerformed( ActionEvent e ) {
            Console.GetConsole().CommenceCommand(e.getActionCommand());
            input.setText("");
            
         }
      });
      
      add(input,BorderLayout.PAGE_END);
      setVisible( true );
      Console.println("Created Console");
   }
   
   public JScrollPane getScroller() {
      return scroller;
   }

   public void CommenceCommand(String bla){
      println(bla);
      if (bla == "exit")
         System.exit(ABORT);
   }
   
   public static Console GetConsole(){
      if (myself == null){
         return new Console();
      }
      return myself;
   }
   
   static void println(String toadd){
      GetConsole();
      content.addElement(toadd);
      System.out.println(toadd);
   }
}



Cursor.java


import com.jme.input.AbsoluteMouse;
import com.jme.input.Mouse;
import com.jme.math.Vector3f;
import com.jme.renderer.Renderer;
import com.jme.scene.state.AlphaState;
import com.jme.scene.state.RenderState;
import com.jme.system.DisplaySystem;



public class Cursor {
   static final int NormalMouse = 1;
   static private Mouse cursor;
   
   Cursor() throws Exception{
      cursor = new AbsoluteMouse( "cursor",DisplaySystem.getDisplaySystem().getWidth(),DisplaySystem.getDisplaySystem().getHeight());
       cursor.setRenderQueueMode( Renderer.QUEUE_ORTHO );
       cursor.registerWithInputHandler( EngineBase.getInput() );
       EngineBase.getHudnode().attachChild(cursor);
       SetMode(Cursor.NormalMouse);
    }
   
   static public void SetMode(int mode) throws Exception{
      switch(mode){
         case(1):{
            DisplaySystem display = DisplaySystem.getDisplaySystem();
            cursor.setRenderState((RenderState) Loader.Get("normalCursor"));
             cursor.setHotSpotOffset(new Vector3f(0,0,0));
             AlphaState as = display.getRenderer().createAlphaState();
             as.setBlendEnabled( true );
             as.setSrcFunction( AlphaState.SB_SRC_ALPHA );
             as.setDstFunction( AlphaState.DB_ONE_MINUS_SRC_ALPHA );
             as.setTestEnabled( true );
             as.setTestFunction( AlphaState.TF_GREATER );
             cursor.setRenderState( as );
             EngineBase.getHudnode().updateRenderState();
         }
      }
   }
}



EngineBase.java


import java.awt.FlowLayout;
import java.net.DatagramSocket;
import java.net.SocketException;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import com.jme.app.VariableTimestepGame;
import com.jme.input.FirstPersonHandler;
import com.jme.input.InputHandler;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.scene.SceneElement;
import com.jme.scene.Text;
import com.jme.scene.state.LightState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.Timer;
import com.jmex.awt.swingui.JMEDesktop;


public class EngineBase extends VariableTimestepGame {
   static EngineBase myself;
   protected Camera cam;
   public Node rootNode;
   private static Node Hudnode;
   protected static InputHandler input;
    protected Timer timer;
    protected Text fps;
    protected float tpf;
    protected boolean showBounds = false;
   private static JDesktopPane desktopPane;
    static String render;
   public static DatagramSocket socket;
   public EngineBase() {
      myself = this;
      // TODO Auto-generated constructor stub
   }
   
   @Override
   protected void cleanup() {
      // TODO Auto-generated method stub
      
   }

   @Override
   protected void initGame() {
      try{
         display.getRenderer().setBackgroundColor( ColorRGBA.black.clone() );
         rootNode = new Node("rootNode");
          ZBufferState buf = display.getRenderer().createZBufferState();
          buf.setEnabled(true);
          buf.setFunction(ZBufferState.CF_LEQUAL);
          rootNode.setRenderState(buf);
          rootNode.setCullMode( SceneElement.CULL_NEVER );
          Hudnode = new Node( "desktop node" );
           rootNode.attachChild( Hudnode );
           Hudnode.setRenderQueueMode( Renderer.QUEUE_ORTHO );
         UIManager.setLookAndFeel( new MetalLookAndFeel() );
          JMEDesktop jmeDesktop = new JMEDesktop("SwingDestop");
           jmeDesktop.setup( display.getWidth(), display.getHeight(), false, input );
           jmeDesktop.setLightCombineMode( LightState.OFF );
          jmeDesktop.setLightCombineMode( LightState.OFF );
          Hudnode.attachChild( jmeDesktop );
          desktopPane = jmeDesktop.getJDesktop();
        
          final JInternalFrame internalFrame = new JInternalFrame("Wayne");
           internalFrame.setLocation(display.getWidth()/2,display.getHeight()/2);
           internalFrame.setResizable( false );
           internalFrame.getContentPane().setLayout( new FlowLayout() );
           internalFrame.getContentPane().add(new JButton("lol"));
           internalFrame.setVisible( true );
           internalFrame.pack();
           internalFrame.grabFocus();
           desktopPane.add( internalFrame );
           new LoadingScreen();
          rootNode.updateRenderState();
      }
      catch(Exception e){
         e.printStackTrace();
      }
   }
   
   public static JDesktopPane getDesktopPane() {
      return desktopPane;
   }
   
   public static InputHandler getInput() {
      return input;
   }

   public float getTpf() {
      return tpf;
   }

   public static Node getHudnode() {
      return Hudnode;
   }

   private void CreateConnection() throws SocketException {
      socket = new DatagramSocket();
      Console.println("Socket created at "+  socket.getLocalPort());
   }

   public static DatagramSocket GetSocket(){
      return socket;
   }
   
   @Override
   protected void initSystem() {
        try {
           display = DisplaySystem.getDisplaySystem(properties.getRenderer());
           display.setTitle("New Horizons");
           display.createWindow(properties.getWidth(),properties.getHeight(),properties.getDepth(),properties.getFreq(),properties.getFullscreen());
           //Save screen size for later use!
           display.setVSyncEnabled(true); //we really don't need more frames than we can display!
           cam = display.getRenderer().createCamera(display.getWidth(),display.getHeight());
           cam.setFrustumPerspective(45.0f,(float) display.getWidth()/(float)display.getHeight(),1,1000);
           Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
           Vector3f left = new Vector3f( -1.0f, 0.0f, 0.0f);
           Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
           Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
           cam.setFrame(loc, left, up, dir);
           cam.update();
           display.getRenderer().setCamera(cam);
           FirstPersonHandler firstPersonHandler = new FirstPersonHandler(cam,50,1);
           input = firstPersonHandler;
          timer = Timer.getTimer();
         }
       
         catch (JmeException e) {
             Console.println(e.toString());
         }
   }

   @Override
   protected void reinit() {
      // TODO Auto-generated method stub

   }

   @Override
   protected void render(float interpolation) {
      display.getRenderer().clearStatistics();
       display.getRenderer().clearBuffers();
       display.getRenderer().draw(rootNode);
   }

   @Override
   protected void update(float interpolation) {
      timer.update();
      tpf = timer.getTimePerFrame();
      input.update( tpf );
      rootNode.updateGeometricState(tpf, true);
   }
}



Loader.java


import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.Vector;
import com.jme.image.Image;
import com.jme.image.Texture;
import com.jme.scene.Node;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;
import com.jme.util.export.binary.BinaryImporter;
import com.jme.util.resource.ResourceLocatorTool;
import com.jme.util.resource.SimpleResourceLocator;
import com.jmex.model.converters.FormatConverter;
import com.jmex.model.converters.MaxToJme;


public class Loader extends Thread{
   static final int TextureState = 1; //tell the precacher to load a TextureState!
   static final int UnanimatedModel = 0;
   
   static Loader myself = null;
   static  Vector<String> topprecache = new Vector<String>();//Stores the filename and path
   static  Vector<String> name = new Vector<String>(); //Stores the simple name if any
   static  Vector<Integer> Types = new Vector<Integer>();//Stores informations what the Loader should Return
   static  Vector<Object> files = new Vector<Object>(); //Stores the Loaded objects may need to be converted prior returning depending on type enum

   //Disable instancing, use Getlaoder instead!
   private Loader(){
   }
   
   public static void AddtoPrecache (String filename,int Type){
      AddtoPrecache(filename,filename,Type);
   }
   
   public static void AddtoPrecache (String filename,String simplename,int Type){
      System.out.println(filename + " added to precache");
      topprecache.add(filename);
      name.add(simplename);
      Types.add(Type);
   }
   
   public static void GetPrecached(String Filename,int Type){
      
   }
   
   public static Loader GetLoader(){
      if (myself == null){
         Console.println("Created new Loader");
         myself = new Loader();
         return myself;
      }
      else{
         return myself;
      }
   }
   
   public void run(){
      Console.println("Started Loader");
      //Start the Loader!
      //How many Items do we have to load?
      int size = topprecache.size();
      Console.println("Loading " + size + " Items");
      //Based on that we could create a loading Bar
      int index = 0;
      while(index < size){
         try{
            Object loaded = LoadFile(topprecache.get(index),Types.get(index)); //Returns a model or a Textur object!
            Console.println(index + " " + loaded.toString());
            files.add(index,loaded);
            index++;
         }
         catch(Exception e){
            e.printStackTrace();
            index++;//Skip it it does not work
         }
      }
      
      //Continue the Game!
      Console.println("Finsihed Loader");
      LoadingScreen.Get().getParent().detachChild(LoadingScreen.Get());

      try {
         new Cursor();
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      EngineBase.getHudnode().updateRenderState();
   }
   
   public Object LoadFile(String name, int Type) throws Exception{
      Console.println("Loading " + name);
      int dotPos = name.lastIndexOf(".");
      String extension = name.substring(dotPos);
        String filename = name.substring(0,dotPos);
      Console.println("Filename = " + filename);
      Console.println("Filetype = " + extension);
      
      Object Loaded = null;
      if (Type == Loader.TextureState){
         Loaded = LoadTextureState(name);
      }
      if (Type == Loader.UnanimatedModel){
         if (extension.equals(".3ds")){
            Loaded = getModel3ds(name);
         }
      }
      return Loaded;
   }
   
   private Node getModel3ds(String name) throws FileNotFoundException, IOException {
      File file = new File(name);
      FormatConverter converter = new MaxToJme();   
      Node model = null;
      ByteArrayOutputStream bo = new ByteArrayOutputStream();
      File input = new File("cache/"+file.getName() + ".jme");
      // check if there is a cached jme format model for the requested file
      if(input.isFile()) {
         ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE,new SimpleResourceLocator(file.getParentFile().toURI()));
         model = (Node)BinaryImporter.getInstance().load(input);
         ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_TEXTURE,
         new SimpleResourceLocator(file.getParentFile().toURI()));
         return model;
      }
      // no cached model found -> convert the 3ds file and cache it
      ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE,new SimpleResourceLocator(file.getParentFile().toURI()));
      converter.convert(new FileInputStream(file), bo);
      model = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(bo.toByteArray()));
      //bo.writeTo(new FileOutputStream("cache/"+file.getName()+".jme"));
      ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_TEXTURE,new SimpleResourceLocator(file.getParentFile().toURI()));
      return model;
   }
   
   private TextureState LoadTextureState(String filename) {
      Console.println("Loading TextureState = " + filename);
        TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
        URL texurl = Loader.class.getClassLoader().getResource(filename);
        ts.setTexture(TextureManager.loadTexture(texurl,Texture.MM_LINEAR,Texture.FM_LINEAR, Image.GUESS_FORMAT_NO_S3TC,1,true));
      return ts;
   }

   static Object Get(String simplename) throws Exception{ //returns the first object with the givin simplename!
      int index = name.indexOf(simplename);
      //Searching for the item!
      //Depending on type we should sue a shared geometry or a cloned one here (or just the same for every)
      Console.println("Trying to get item at " + index);
      return files.get(index);
   }
}



LoadingScreen.java


import com.jme.image.Texture;
import com.jme.scene.Node;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;

public class LoadingScreen extends Node {
   private static final long serialVersionUID = 1150983124443967599L;
   static DisplaySystem display = DisplaySystem.getDisplaySystem();
   static Node myself;
   
   public LoadingScreen() {
      super("LoginScreen");
      myself = this;
      //Just a small background block!
      //We need the background now!
      String texturepath = "Textures/LoadingScreen_" + (int)(Math.random()*10) + ".png";
      Console.println("Loading file "+ texturepath); //$NON-NLS-1$
      Texture loadingscreentexture = TextureManager.loadTexture(LoadingScreen.class.getClassLoader().getResource(texturepath),Texture.MM_LINEAR_LINEAR,Texture.FM_LINEAR );
      Quad loadscreen = new Quad("Quad",DisplaySystem.getDisplaySystem().getWidth(),DisplaySystem.getDisplaySystem().getHeight()); //$NON-NLS-1$
      TextureState ts = display.getRenderer().createTextureState();
      ts.setTexture(loadingscreentexture);
      ts.setEnabled(true );
      loadscreen.setRenderState( ts );
      loadscreen.updateRenderState();
      this.setLocalTranslation( display.getWidth() / 2, display.getHeight() / 2, 0 );
      this.attachChild(loadscreen);
      this.setLightCombineMode( LightState.OFF );
       EngineBase.getHudnode().attachChild(this);
      //Load the models before continuing
      Loader myloader = Loader.GetLoader();
     //  myloader.run();
      myloader.start();
   }
   
   static Node Get(){
      return myself;
   }
   
   public void update(float interpolation){
   }
}



And finally here the used Textures
http://empirephoenix.de/Textures.rar

Okay, maybe I wasn't very clear…



By posting either a code fragment or your entire project you are asking someone to put forth quite a bit of effort and time to look at your stuff.  If it is an issue that can easily be identified with 2 or 3 lines than a fragment is fine (hopefully we can all trace 2 or 3 lines of code easily).  Anymore than that however should be made into a 'test', ONE single file with a main method that someone can just copy the entire thing at once, paste and then run it.



In your first setup someone would have to take your code fragment and put it into a jME environment that may or may not be the same as yours (5-15mins).  In your second setup you are asking someone to basically rebuild your entire project (AND trace through it) to find where the issue is (possible one character…) (15-60mins!).



So, and I don't mean to be rude here, if you would like constructive help; please create a test made up of a single file w/ a main method that someone can easily copy and paste (one time) and run it.  This test should show the problem and nothing more…

Ok did nto understand you really, here it is:



import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import com.jme.app.VariableTimestepGame;
import com.jme.input.InputHandler;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.scene.SceneElement;
import com.jme.scene.Text;
import com.jme.scene.state.LightState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.Timer;
import com.jmex.awt.swingui.JMEDesktop;


public class EngineBase extends VariableTimestepGame {
   static EngineBase myself;
   protected Camera cam;
   public Node rootNode;
   private static Node Hudnode;
   protected static InputHandler input;
    protected Timer timer;
    protected Text fps;
   private float tpf;
   private static JDesktopPane desktopPane;
   
   public static void main(String[] args) {
      EngineBase game = new EngineBase();
      game.setDialogBehaviour(2);
      game.start();
      
   }
   
   @Override
   protected void cleanup() {
   }

   @Override
   protected void initGame() {
      try{
         display.getRenderer().setBackgroundColor( ColorRGBA.black.clone() );
         rootNode = new Node("rootNode");
          ZBufferState buf = display.getRenderer().createZBufferState();
          buf.setEnabled(true);
          buf.setFunction(ZBufferState.CF_LEQUAL);
          rootNode.setRenderState(buf);
          rootNode.setCullMode( SceneElement.CULL_NEVER );
          Hudnode = new Node( "desktop node" );
           rootNode.attachChild( Hudnode );
           Hudnode.setRenderQueueMode( Renderer.QUEUE_ORTHO );
         UIManager.setLookAndFeel( new MetalLookAndFeel() );
          JMEDesktop jmeDesktop = new JMEDesktop("SwingDestop");
           jmeDesktop.setup( display.getWidth(), display.getHeight(), false, input );
           jmeDesktop.setLightCombineMode( LightState.OFF );
          jmeDesktop.setLightCombineMode( LightState.OFF );
          Hudnode.attachChild( jmeDesktop );
          desktopPane = jmeDesktop.getJDesktop();
        
          final JInternalFrame internalFrame = new JInternalFrame("Wayne");
           internalFrame.setLocation(display.getWidth()/2,display.getHeight()/2);
           internalFrame.setResizable( false );
           internalFrame.getContentPane().setLayout( new FlowLayout() );
           internalFrame.getContentPane().add(new JButton("lol"));
           internalFrame.setVisible( true );
           internalFrame.pack();
           internalFrame.grabFocus();
           desktopPane.add( internalFrame );
          rootNode.updateRenderState();
      }
      catch(Exception e){
         e.printStackTrace();
      }
   }
   
   @Override
   protected void initSystem() {
        try {
           display = DisplaySystem.getDisplaySystem(properties.getRenderer());
           display.setTitle("New Horizons");
           display.createWindow(properties.getWidth(),properties.getHeight(),properties.getDepth(),properties.getFreq(),properties.getFullscreen());
           //Save screen size for later use!
           display.setVSyncEnabled(true); //we really don't need more frames than we can display!
           cam = display.getRenderer().createCamera(display.getWidth(),display.getHeight());
           cam.setFrustumPerspective(45.0f,(float) display.getWidth()/(float)display.getHeight(),1,1000);
           Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
           Vector3f left = new Vector3f( -1.0f, 0.0f, 0.0f);
           Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
           Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
           cam.setFrame(loc, left, up, dir);
           cam.update();
           display.getRenderer().setCamera(cam);
           timer = Timer.getTimer();
         }
       
         catch (JmeException e) {
         }
   }

   @Override
   protected void reinit() {
      // TODO Auto-generated method stub

   }

   @Override
   protected void render(float interpolation) {
      display.getRenderer().clearStatistics();
       display.getRenderer().clearBuffers();
       display.getRenderer().draw(rootNode);
   }

   @Override
   protected void update(float interpolation) {
      timer.update();
      tpf = timer.getTimePerFrame();
      rootNode.updateGeometricState(tpf, true);
   }
}



As simple as i could get it this time, hope this is more what is needed then.

That is PERFECT, okay I have it up and running; and yes I do not see any GUI stuff…



I have to leave now for a little while, sorry; but will continue to test (for a few mins) when I get back.

Not that I use jDeskTop at all, but after comparing your code with the test code: the test code does not add the GUI node  to the rootNode (which you are) and it renders with:


     protected void simpleRender() {
        // draw the gui stuff after the scene
        display.getRenderer().draw( Hudnode );
    }



Your render routine:


    @Override
    protected void render( float interpolation ) {
        display.getRenderer().clearStatistics();
        display.getRenderer().clearBuffers();
        display.getRenderer().draw( rootNode );
    }



Also, I should point out that the differences between BaseGame and VariableTimeStepGame: BaseGame is the most simplistic implementation of all the jME 'game modes' it renders as fast as it can and supplies -1 as the interpolation value for both the render and update methods. VariableTimeStepGame is exactly the same as BaseGame except that it supplies the correct timePerFrame to the update method.
SimpleGame is an extension of BaseGame which gives programmer a lot of features for debugging and testing (wireframe, fps, etc)  I would really recommend either using simpleGame until you get comfortable with jME, and if you need to release something its pretty easy to go from simple game to an implementation that has less debugging tools available.

The hudnode is attached to the root node, so that's no problem.



I also had problems with jmedesktop in the past, it wouldn't show sometimes. (there are a few threads about those problems in the forum)

i experimented a bit with your code, and this seems to display the button always.



Notice that you should always create the swing stuff in the swing thread.

If you remove the sleep() it will only show like 1 out of 10 times on my machine, i guess its some kind of concurrency problem.



           try {
               SwingUtilities.invokeLater( new Runnable() {
                   public void run() {
                       // Only access the Swing UI from the Swing event dispatch thread!
                       // See SwingUtilities.invokeLater()
                       // and http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html for details.
                       final JInternalFrame internalFrame = new JInternalFrame("Wayne");
                       internalFrame.setLocation(display.getWidth()/2,display.getHeight()/2);
                       internalFrame.setResizable( false );
                       internalFrame.getContentPane().setLayout( new FlowLayout() );
                       internalFrame.getContentPane().add(new JButton("lol"));
                       internalFrame.setVisible( true );
                       internalFrame.pack();
                       internalFrame.grabFocus();
                       desktopPane.add( internalFrame );
                       try {
                     Thread.sleep(2000);
                  } catch (InterruptedException e) {
                     e.printStackTrace();
                  }
                   }
               } );
           } catch ( Exception e ) {
               throw new RuntimeException( e );
           }



Hi, thanks for the fast help, but I assume right that you put that codesnippet at the place where mine internal frame stuff was before and did not changed anything else? Cause then for me it does not work  :?



Also what other Gui Systems would you advice for a beginner? (The Gui sticky just does not say anything how hard they areto integrate and use)

yep that was the only change.

Do TestJMEDesktop / TestJMEDesktopState / HelloJMEDesktop.java work for you ?

Maybe you can see a difference from your code to those tests.



Hmm maybe you could also try GBUI also, i think its more used than jMEDesktop.

Yes, the Test ones work, funny thing is, that mine was a copy paste from them in the beginning.



Well I will try GBUI hopefully it works better.

ahh sorry, i didn’t have the most recent jme version.

it seems that r4075  broke jMEDesktop :frowning:




edit:

nevermind that problem is not related it seems

Hm, at least that explains why it is not working, neither me nor my computers fault  :wink:

I found a simple fix, I simply must draw (inside renderfunction) the Hudnode after everything else, instead of attaching it to the rootNode, also as said above the Swing stuff must be created inside the SwingThread



       display.getRenderer().clearBuffers();
       display.getRenderer().draw(rootNode);
       display.getRenderer().draw( guiNode );

Maybe the jMEDesktop should be rendered as a pass, does this seem like a common problem people have with it?