SWT display issue

Hi,



I tested successfully the jme swt and awt example. I tried to embed a jme canvas into an rcp application. Using a jogl canvas in an embedded swt frame does work, but using a lwjgl canvas "fails" (which should be better supported than jogl?). Means, it seems the spatials are rendered (i made FooMesh extends TriMesh, and made a sysout in the draw(…) method) - but i do not see any objects. What i see ist just the background (i can change the background color).



The part in the RCP-View:


public void createPartControl(Composite parent) {
   try {
      parent.setLayout(new FillLayout());

      boolean useJOGL = false;

      if (useJOGL) {
         // working (JOGLImplementor is nearly the same as LWJGLImplementor)
         SimpleCanvasImpl impl = new JOGLImplementor(gInput);
         canvas = ((JOGLImplementor) impl).getCanvas();

         Frame frame = SWT_AWT.new_Frame(new Composite(parent, SWT.EMBEDDED | SWT.FILL));
         frame.add(canvas);
         frame.setVisible(true);

         canvas.setFocusable(true);

         Animator animator = new Animator(canvas);
         animator.start();
      } else {
         // see only background (color changes possible - thus smth. seems to happen
         Composite comp = new Composite(parent, SWT.NONE);
         comp.setLayout(new FillLayout());

         DisplaySystem ds = DisplaySystem.getDisplaySystem(LWJGLSystemProvider.LWJGL_SYSTEM_IDENTIFIER);
         ds.registerCanvasConstructor("SWT", LWJGLSWTCanvasConstructor.class);

         HashMap<String, Object> props = new HashMap<String, Object>();
         props.put(LWJGLSWTConstants.PARENT, comp);
         props.put(LWJGLSWTConstants.STYLE, SWT.NONE);
         props.put(LWJGLSWTConstants.DEPTH_BITS, 8);
         final LWJGLSWTCanvas canvas = (LWJGLSWTCanvas) ds.createCanvas(LWJGLImplementor.width, LWJGLImplementor.height, "SWT", props);
         canvas.setUpdateInput(true);
         canvas.setTargetRate(60);

         KeyInput.setProvider(SWTKeyInput.class.getCanonicalName());
         canvas.addKeyListener((SWTKeyInput) KeyInput.get());

         SWTMouseInput.setup(canvas, true);

         // Important! Here is where we add the guts to the panel:
         LWJGLImplementor impl = new LWJGLImplementor(LWJGLImplementor.width, LWJGLImplementor.height);
         canvas.setImplementor(impl);

         canvas.init();
         canvas.render();
      }



and the implementor:


public class LWJGLImplementor extends SimpleCanvasImpl {

   private Quaternion rotQuat;
   private float angle = 0;
   private Vector3f axis;
   private Box box;
   long startTime = 0;
   long fps = 0;
   private InputHandler input;
   private List<Updatable> updatables = new ArrayList<Updatable>();
   private InputManager inputManager = new InputManager(Vector3f.UNIT_Z.clone());

   public static int width = 640, height = 480;

   public LWJGLImplementor(int width, int height) {
      super(width, height);
   }

   @Override
   public void simpleSetup() {

      // Normal Scene setup stuff...
      rotQuat = new Quaternion();
      axis = new Vector3f(1, 1, 0.5f);
      axis.normalizeLocal();

      startTime = System.currentTimeMillis() + 5000;

      // create nodes
      Node envNode = new Node("environment");
      rootNode.attachChild(envNode);

      // Grid/ Floor
      envNode.attachChild(new AxisGrid());

      // rods
      AxisRods ar = new AxisRods("rods", true, 0.3f);
      envNode.attachChild(ar);

      setupInput(getRootNode());

      Node cameraNode = new Node("cameras");
      envNode.attachChild(cameraNode);

      getRenderer().setBackgroundColor(ColorRGBA.blue.clone());

      setupInput(getRootNode());
   }

   @Override
   public void simpleUpdate() {
      input.update(tpf);

      // Code for rotating the box... no surprises here.
      if (tpf < 1) {
         angle = angle + (tpf * 25);
         if (angle > 360) {
            angle = 0;
         }
      }
      // rotQuat.fromAngleNormalAxis(angle * FastMath.DEG_TO_RAD, axis);
      // box.setLocalRotation(rotQuat);

      if (startTime > System.currentTimeMillis()) {
         fps++;
      } else {
         long timeUsed = 5000 + (startTime - System.currentTimeMillis());
         startTime = System.currentTimeMillis() + 5000;
         System.out.println(fps + " frames in " + (timeUsed / 1000f) + " seconds = " + (fps / (timeUsed / 1000f)) + " FPS (average)");
         fps = 0;
      }
   }

   private void setupInput(Node ar) {
      input = inputManager;

      inputManager.setup(cam);
      inputManager.getOrbit().setWheelDirection(false);
      // The target position is the point the camera orbits around
      inputManager.getOrbit().setTargetPosition(new Vector3f(), true);

      // Set the node used when picking
      inputManager.getCameraFocus().setNode(ar);
   }

   /*
    * (non-Javadoc)
    *
    * @see org.monklypse.core.SWTDefaultImplementor#simpleRender()
    */
   @Override
   public void simpleRender() {
      super.simpleRender();
   }

   public long getFPS() {
      return this.fps;
   }

   public void addUpdatable(Updatable u) {
      this.updatables.add(u);
   }

   public void removeUpdatable(Updatable u) {
      this.updatables.remove(u);
   }

   public void fireUpdate() {
      for (Updatable u : updatables) {
         // u.update(1);
      }
   }
}



Any help would be great!