JMEDesktop invisible?

im upgrading my app from jme 1.0 and old physics to jme from cvs and new physics. I immediatly run into a problem with JMEDesktop.

its there and i can click on it but i cant see it. It worked fine before upgrade. any ideas what might have changed to cause this?

I have a simple example of invisible desktop I can post if noone has easy answer. thanks in advance dudes 8)

the JMEDesktop tests work fine, its prob a simple mistake im making but I sure cant find it.

here is an example of problem, it should be a window with a button to exit,

but I get an invisible button/desktop. I can click on it but I cant see it.

import java.util.logging.Level;




import com.jme.input.InputSystem;

import com.jme.input.KeyInput;

import com.jme.input.MouseInput;

import com.jme.input.joystick.JoystickInput;

import com.jme.renderer.ColorRGBA;

import com.jme.system.DisplaySystem;

import com.jme.system.JmeException;

import com.jme.util.LoggingSystem;

import com.jme.util.Timer;

public class MainGame {



    private static boolean finished;

    protected DisplaySystem display;

   private Timer timer;

   private int width, height, depth, freq;

   private boolean fullscreen;

   private float tpf;


   public static void main(String[] args) {


      MainGame app = new MainGame();





   protected void assertDisplayCreated() throws JmeException {

        if (display == null) {

            LoggingSystem.getLogger().log(Level.SEVERE, "Display system is null.");

            throw new JmeException("Window must be created during" + " initialization.");


        if (!display.isCreated()) {

            LoggingSystem.getLogger().log(Level.SEVERE, "Display system not initialized.");

            throw new JmeException("Window must be created during" + " initialization.");



   public final void start() {

        LoggingSystem.getLogger().log(Level.INFO, "Application started.");

        try {


            if (!finished) {




                // main loop

                while (!finished && !display.isClosing()) {










        } catch (Throwable t) {




        LoggingSystem.getLogger().log(Level.INFO, "Application ending.");

        if (display != null)




   protected void quit() {

        if (display != null)





   protected void initSystem() {


      width = 800;

      height = 600;

      depth = 16;

      freq = 60;

      fullscreen = false;


      try {


         display = DisplaySystem.getDisplaySystem();

           display.createWindow(width, height, depth, freq, fullscreen);


      } catch (JmeException e) {







      timer = Timer.getTimer();




   protected void initGame() {



      GameState menu = new MainMenuState("main menu");






   protected void cleanup() {


      LoggingSystem.getLogger().log(Level.ALL, "Cleaning up resources.");







   protected void update(float interpolation) {



      tpf = timer.getTimePerFrame();





   protected final void render(float interpolation) {   






   public static void exit() {

      finished = true;




import java.awt.Color;

import javax.swing.JButton;

import com.foosball.main.MainGame;
import com.jme.input.InputHandler;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.input.MouseInput;
import com.jme.input.action.InputActionEvent;
import com.jme.renderer.Renderer;
import com.jme.scene.Node;
import com.jme.scene.Spatial;
import com.jme.scene.state.LightState;
import com.jme.system.DisplaySystem;
import com.jmex.awt.swingui.JMEAction;
import com.jmex.awt.swingui.JMEDesktop;

public class MainMenuState extends StandardGameState {
   private DisplaySystem display = DisplaySystem.getDisplaySystem();
    private InputHandler input;
    private Node menuNode;
    private static JMEDesktop desktop;
    private final JButton exitGameButton ;
    public MainMenuState(String name) {

       exitGameButton = new JButton( "Exit Game" );
        menuNode = new Node("menu node");
   public void onActivate() {
      display.setTitle("Main Menu");

   protected void initInput() {
      input = new InputHandler();
   private void initMenu() {
          desktop = new JMEDesktop( "desktop" );
          desktop.setup( 420, 200, false, input );
          desktop.getLocalTranslation().set( display.getWidth() / 2 , display.getHeight() / 2, 0 );
          desktop.getJDesktop().setBackground( new Color(.6f, .6f, .6f, .6f ) );
          menuNode.attachChild( desktop );
          exitGameButton.setSize( 300, 200);
             // action that gets executed in the update thread:
              exitGameButton.addActionListener( new JMEAction( "my action", input ) {
                  public void performAction( InputActionEvent evt ) {
           menuNode.updateGeometricState(0, false);
   public void cleanup(){
   protected void stateUpdate(float tpf) {
      if (KeyBindingManager.getKeyBindingManager().isValidCommand(
                "exit_game", false)) {
   protected void stateRender(float tpf){

I don't have a clue…

Please check if the JMEDesktop tests run fine for you. If yes, maybe you are setting it up differently?

Looks ok to me :expressionless:

To figure it out try the following: replace the the JMEDesktop by a Quad of the same size. Make sure that you see that one. When you do put a texture on it - should still be ok. Then replace with JMEDesktop again. If it's not visible after that the texture isn't painted - post back here then. I suspect the problem being somewhere before that :slight_smile:

I replaced desktop with a quad and I saw the quad no problem. I then added a texture and it was fine. I removed quad and put JMEDesktop back in and it was still invisible. then I tried adding both at same time, when I did that I got the button to show up on top of the quad, but as soon as I remove quad the JMEDesktop goes invisible.

sounds like culling - try setting CULL_NEVER on the desktop, too. (I thought the whole branch would not be culled if menuNode had that set :?)

Or apply model bounds (e.g. BoundingSphere, not sure BBox will work)…

I tried



desktop.setModelBound(new BoundingSphere());


and still nothing.

hmm, no idea then. Seems you have to step through the draw(menuNode) method and have a look where it bails out…

well, I tried stepping through the draw() method and everything looked okay, no obvious reason why its not drawing. It doesnt seem to be culling the desktop as far as I can tell. I have no clue, im going to keep messing with it though maybe I can figure something out.

I saw something similar at work but it was only evident on my mac.  I was using a semi transparent frame as a console.

Im in Linux, but I also tested the same app in windows and got the same results. I guess for now ill just put my JMEDesktop on top of a quad, I can easily remove it later.

sounds like culling
I think you are right irrisor, I can recreate this bug by culling the desktop and quad when they do show. So now I just have to figure out where the desktop is getting culled and why.

things are getting worse, now I cant even create a JMEDesktop in my game without an error. I havent changed anything in my JMEDesktop creation I just updated from jme 1.0 to cvs version. I get error saying I should create my JMEDesktop in swing thread :? I tried it just for kicks and got a hot spot error. I dont know whats going on here, but im having a JMEDesktop meltdown. this error is not from example code in previous post but its from an example very similar, the JMEDesktops are created the same.

java.lang.IllegalStateException: not in swing thread!
   at com.jmex.awt.swingui.JMEDesktop.dispatchEvent(
   at com.jmex.awt.swingui.JMEDesktop.setFocusOwner(
   at com.jmex.awt.swingui.JMEDesktop.setup(
   at com.jmex.awt.swingui.JMEDesktop.<init>(
   at com.jmex.awt.swingui.JMEDesktop.<init>(
   at com.jme.input.ActionTrigger.performAction(
   at com.jme.input.util.SyntheticTrigger.performAction(
   at com.jme.input.InputHandler.update(
   at com.foosball.main.MainFoosballGame.update(
   at com.foosball.main.MainFoosballGame.start(
   at com.foosball.main.MainFoosballGame.main(