title: Cant create cube in Libgdx
body: <p>I was working on a game and i was thinking about wheter it should be 3 Dimensional or not.</p>
  <p>So i figured i would give 3D a try and experiment with it a little.</p>
  <p>I first tried implementing a 3D Camera into my current Game which didnt wield any results.</p>
  <p>Next i made another projetct and tried creating a cube there i figured maybe there was something wrong with my Game class.</p>
  <p>After watchting a few tutorials and checking the values over and over again which also didnt work.
  I searched for a new Tutorial updateted and just copy pasted the entire code.</p>
  <p>I the the tutorial it worked perfectly in my game which is now basically the same class except the class name it doesnt print Statements in the create and render functions also work so it definetly is doing something and it also doesnt throw any exceptions als checked if some values are null the arent.</p>
  <p>Does anyone have any ideas whats going?</p>
  <p>Now i know this code also hase some kind of rotation of the original cube and that makes things more complicated but since it didnt work before im pretty sure removing that part wont make much of difference.</p>
  <p>Thanks for any kind of help in advance!</p>
  <p>Here ist my now copied code:</p>
  <pre><code>
      private PerspectiveCamera camera;
  
      private ModelBatch modelBatch;
  
      private Model box;
  
      private ModelInstance boxInstance;
  
      private Environment environment;
  
  
  
      @Override
  
      public void create() {
  
          // Create camera sized to screens width/height with Field of View of 75 degrees
  
  
  
          camera = new PerspectiveCamera(
  
                  75,
  
                  Gdx.graphics.getWidth(),
  
                  Gdx.graphics.getHeight());
  
  
  
          // Move the camera 3 units back along the z-axis and look at the origin
  
          camera.position.set(0f,0f,3f);
  
          camera.lookAt(0f,0f,0f);
  
          camera.projection.set(camera.projection);
  
  
  
          // Near and Far (plane) repesent the minimum and maximum ranges of the camera in, um, units
  
          camera.near = 0.1f;
  
          camera.far = 300.0f;
  
  
  
          // A ModelBatch is like a SpriteBatch, just for models.  Use it to batch up geometry for OpenGL
  
          modelBatch = new ModelBatch();
  
  
  
          // A ModelBuilder can be used to build meshes by hand
  
          ModelBuilder modelBuilder = new ModelBuilder();
  
  
  
          // It also has the handy ability to make certain premade shapes, like a Cube
  
          // We pass in a ColorAttribute, making our cubes diffuse ( aka, color ) red.
  
          // And let openGL know we are interested in the Position and Normal channels
  
          box = modelBuilder.createBox(2f, 2f, 2f,
  
                  new Material(ColorAttribute.createDiffuse(Color.BLUE)),
  
                  VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal
  
          );
  
  
  
          // A model holds all of the information about an, um, model, such as vertex data and texture info
  
          // However, you need an instance to actually render it.  The instance contains all the
  
          // positioning information ( and more ).  Remember Model==heavy ModelInstance==Light
  
          boxInstance = new ModelInstance(box,0,0,0);
  
  
  
          // Finally we want some light, or we wont see our color.  The environment gets passed in during
  
          // the rendering process.  Create one, then create an Ambient ( non-positioned, non-directional ) light.
  
          environment = new Environment();
  
          environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.8f, 0.8f, 0.8f, 1.0f));
  
      }
  
  
  
      @Override
  
      public void dispose() {
  
          modelBatch.dispose();
  
          box.dispose();
  
      }
  
  
  
      @Override
  
      public void render() {
  
          // You’ve seen all this before, just be sure to clear the GL_DEPTH_BUFFER_BIT when working in 3D
  
          Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
  
          Gdx.gl.glClearColor(1, 1, 1, 1);
  
          Gdx.gl.glClear(Gdx.gl20.GL_COLOR_BUFFER_BIT | Gdx.gl20.GL_COLOR_BUFFER_BIT);
  
  
  
          // For some flavor, lets spin our camera around the Y axis by 1 degree each time render is called
  
          camera.rotateAround(Vector3.Zero, new Vector3(0,1,0),1f);
  
          // When you change the camera details, you need to call update();
  
          // Also note, you need to call update() at least once.
  
          camera.update();
  
  
  
          // Like spriteBatch, just with models!  pass in the box Instance and the environment
  
          modelBatch.begin(camera);
  
          modelBatch.render(boxInstance, environment);
  
          modelBatch.end();
  
      }
  
  
  
      @Override
  
      public void resize(int width, int height) {
  
      }
  
  
  
      @Override
  
      public void pause() {
  
      }
  
  
  
      @Override
  
      public void resume() {
  
      }
  
  }
  
  </code></pre>