title: Displaying 3D models with an OrthographicCamera in LibGDX
body: <p>So basically I'm trying to display a .obj 3D Model with an OrthographicCamera in 2D rather than in 3D with a PerspectiveCamera.</p>
  
  <p>Everything works fine when I render with the PerspectiveCamera, however if I switch it to Orthographic, nothing displays, just the blank background.</p>
  
  <p>Below is the code I'm using with the PerspectiveCamera stuff commented out. I'm not sure if there is a different way that I need to setup the OrthographicCamera, or if I need to use a PerspectiveCamera with some modified to views to achieve this. At this point it really doesn't matter which axis I "eliminate".</p>
  
  <p>Essentially what I want to achieve is being able to use Blender for my 2D animation. I've figured this out on the Blender side and it works very well, however they must be imported as .obj(or .fbx) into LibGDX, these are loaded into LibGDX as Models, and as such must be rendered with a ModelBatch using a ModelInstance and an Environment. I need a way to view this object using a 2D Orthographic projection rather than a 3D Perspective projection.</p>
  
  <p>Anyone got any suggestions for this?</p>
  
  <pre><code>public class Test extends ApplicationAdapter {
  
  //public PerspectiveCamera cam;
  public OrthographicCamera cam;
  public CameraInputController camController;
  
  public ModelBatch modelBatch;
  
  public ModelInstance ship;
  
  public Environment environment;
  
  @Override
  public void create() {
      modelBatch = new ModelBatch();
  
      environment = new Environment();
      environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
      environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
  
      /*
      cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      cam.position.set(10f, 10f, 10f);
      cam.lookAt(0, 0, 0);
      cam.near = 1f;
      cam.far = 10f;
      cam.update();
      */
  
      cam = new OrthographicCamera();
      cam.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      cam.update();
  
      camController = new CameraInputController(cam);
      Gdx.input.setInputProcessor(camController);
  
      ObjLoader loader = new ObjLoader();
      Model model = loader.loadModel(Gdx.files.internal("data/invader.obj"));
      ship = new ModelInstance(model);
  }
  
  @Override
  public void render() {
      camController.update();
  
      Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
  
      modelBatch.begin(cam);
      modelBatch.render(ship, environment);
      modelBatch.end();
  }
  
  @Override
  public void dispose() {
      modelBatch.dispose();
  }
  }
  </code></pre>