1 Reply Latest reply: Feb 26, 2012 1:15 PM by 886206 RSS

    Simple 3D box example - background color

    917743
      Hi,
      I'm using java 3D to display a simple wireframe box, on a red background. Problems are:
      - sometimes the entire canvas is colored in red, the box seems to disappear behind the background color
      - sometimes only the box is visible on a black background (instead of red)
      - when i resize the frame a little, the image changes between one of the above states ...
      my code:
              SimpleUniverse universe = new SimpleUniverse();
              BranchGroup group = new BranchGroup();
              Appearance app = new Appearance();
            
              //Create the polygon attributes
              PolygonAttributes polyAttr = new PolygonAttributes();
            
              //Set them so that the draw mode is polygon line
              polyAttr.setPolygonMode(PolygonAttributes.POLYGON_LINE);
            
              //Use these in the appearance
              app.setPolygonAttributes(polyAttr);
            
              Box box = new Box(0.1f, 0.1f, 0.1f, app);
              group.addChild(box);
            
              universe.getCanvas().setBackground(Color.red);
              universe.getViewingPlatform().setNominalViewingTransform();
              universe.addBranchGraph(group);
      i want a cube on a red background, but i randomly get one of following states:
      http://www.ttweb.be/problem.jpg

      what am i doing wrong ? any help would be appreciated