GameState Lag

For me, adding an object to a GameState rootNode renders the object a lot slower as opposed adding it to the rootNode of SimpleGame. Is this normal or must I be doing something wrong? If, for example, I make a dozen spheres at the same time, the gamestate version of my code appears to render them one at a time, whereas the simplegame version renders them all at the same time.


visual = new DebugGameState();
      GameStateManager.getInstance().attachChild(visual);
      visual.setActive(true);



   public void makeBall(String guid, float x, float y, float p) {
      // normalize x and y
      x = x - aspect / 2f;
      y = y - 1 / 2f;

      //System.out.println("(x,y): (" + x + "," + y + ")");
      
      // check to see if there is a ball already at x,y
      PickResults pr = new BoundingPickResults();
      Ray touchRay = new Ray(new Vector3f(x, y, -20), new Vector3f(0, 0, 1));
      pr.clear(); // might not need this
      visual.getRootNode().findPick(touchRay, pr);

      // if a ball isn't already there, create one
      if (pr.getNumber() < 1) {
         Sphere ball = new Sphere(guid, new Vector3f(), 63, 50, 1);
         ball.setLocalScale(p / 2000f);
         ball.setLocalTranslation(x, y, 0);
         MaterialState randColor = game.getDisplay().getRenderer()
               .createMaterialState();
         randColor.setDiffuse(ColorRGBA.randomColor());
         ball.setRenderState(randColor);
         ball.setModelBound(new BoundingSphere());
         ball.updateModelBound();
         
         visual.getRootNode().attachChild(ball);

         // update RenderState and GeometricState
         ball.updateRenderState();
      }
      // otherwise change the name of the ball to the new guid
      else {
         pr.getPickData(0).getTargetMesh().getParentGeom().setName(guid);
      }
   }


they have no difference at all.



make sure u r not rendering the scene twice in ur game state version.

My problem doesn't seem to have anything to do with gamestates, I previously was using a boundingbox and now am using a boundingsphere. When I swap boundingsphere for boundingbox in my latest code, everything runs a LOT faster. Does this make sense? I guess it is harder to draw a bounding sphere with >50 zsamples and >50 radialsamples than a box, right? If I really wanted to use a boundingsphere, would there be a way to make this more efficient? Would I have to just decrease the number of samples? Thanks for the suggestion.