Is there a better way to draw 2D pics than using Quads & Texture?

I want to draw some 2D pictures (from files) to build up my basic user interface.

Only Quads can do this?

Is there a better way to draw 2D pics than using Quads & Texture?

Hello,



I'm not an expert, but I'll try to help.

I'm developing a game engine wich uses a great amount of 2d images; some r used as part of the GUI, others are just full-screen displayed. I think the best approach is to use JMEDesktops. Those are objects in which you can embedd any component of the swing library (including JPanels, for instance). Then you put the JMEDesktop into a node. You'll find a lot of examples on the forums, but I leve one for you here:


public class FunctionalSlideScene {

   /**
    * The JMonkey node which contains the slides.
    */
   private Node slideNode;

   /**
    * This JMEDesktop contains a slidesJPanel
    */
   private JMEDesktop slidesMenu;

   /**
    * The SlidesJPanel that contains the slides images
    */
   private SlidesJPanel slidesJPanel;

   public FunctionalSlideScene(InputHandler ih) {
      slideNode = new Node("slides");
      slideNode = createSlides(ih);

   }

   /**
    * MAIN METHOD TO CREATE THE JMEDESKTOP
    * @param ih
    * @return
    */
   private Node createSlides(InputHandler ih) {

      // Create the node which will contain the JMEDesktop
      DisplaySystem display = DisplaySystem.getDisplaySystem();
      Node slidesNode = new Node("slides");
      slidesNode.setRenderQueueMode(Renderer.QUEUE_ORTHO);
      
      // Create the JMEDesktop and attach it to the node
      slidesMenu = new JMEDesktop("desktop", display.getWidth(), display
            .getHeight(), ih);

      slidesNode.attachChild(slidesMenu);
      slidesMenu.getLocalTranslation().set(512, 380, 0);

      // Create the panel which goes inside the jmedesktop (it is just a jpanel)
      slidesJPanel = new SlidesJPanel();
      slidesMenu.getJDesktop().add(slidesJPanel);
      slidesJPanel.setLocation(0, 0);
      slidesJPanel.setSize(display.getWidth(), display.getHeight());

      slidesMenu.getJDesktop().setBackground(null);
      slidesMenu.getJDesktop().setOpaque(false);
      slidesMenu.getJDesktop().setVisible(true);

      slidesNode.setCullMode(SceneElement.CULL_NEVER);
      slidesNode.setLightCombineMode(LightState.OFF);
      slidesNode.updateRenderState();
      slidesNode.updateGeometricState(0, true);
      MouseInput.get().setCursorVisible(false);

      return slidesNode;

   }



I hope this helps

What you want to do, is most likely achieved with HUDs:



http://www.jmonkeyengine.com/wiki/doku.php?do=search&id=hud

set ur render queue to Ortho queue will allow u to render 3d meshes into 2d plane.

Well, finally I planned to use JPanels to draw pictures. I found that they will not cut down ths FPS a lot. So maybe it's a good way to draw my UI.



Thank you all again.

@jimnox

I just want to make you aware that SWING UI does not work correctly under Mac OS X. Your application will not be crossplatform if you use SWING.



@neakor

Ortho queue puts objects in the queue for orthogonal projection to the view plane; also perspective drawing is a projection to the view plane. The difference is not the plane (2D or 3D), but the projection matrix.

Ender said:

@jimnox
I just want to make you aware that SWING UI does not work correctly under Mac OS X. Your application will not be crossplatform if you use SWING.

@neakor
Ortho queue puts objects in the queue for orthogonal projection to the view plane; also perspective drawing is a projection to the view plane. The difference is not the plane (2D or 3D), but the projection matrix.


Maybe my program will run only on Windows and X-window but..Still thanks for awaring~ :)
Ender said:

@neakor
Ortho queue puts objects in the queue for orthogonal projection to the view plane; also perspective drawing is a projection to the view plane. The difference is not the plane (2D or 3D), but the projection matrix.


em...thats exactly what i meant.... it puts the object into 2d plane. i guess i shouldnt use the word put but rather project.

Sorry neakor, mine is not a campain against what you say and I wouldn't want to go OT, but, IMHO, it is important to undersand that it is not a mater of using "put" vs "project" words. The difference between the two cases, is the kind of projection used, a perspective projection and a orthogonal projection. The plane where you project them is not relevant.