title: OpenGL Orthographic Projections
body: <p>I'm attempting to set up an orthographic projection in OpenGL, but can't seem to find why this triangle is not rendering correctly (it isn't visible). I have used perspective projection with the same code (apart from my vertex coordinates and projection matrix, of course) and it works fine. I construct the triangle vertices as:</p>
  
  <pre><code>Vertex vertices[] = { Vertex(glm::vec3(0, 600, 0.0),        glm::vec2(0.0, 0.0)),
                        Vertex(glm::vec3(300, 0, 0.0),        glm::vec2(0.5, 1.0)),
                        Vertex(glm::vec3(800 , 600, 0.0),     glm::vec2(1.0, 0.0)) };
  </code></pre>
  
  <p>My camera constructor is:</p>
  
  <pre><code>Camera::Camera(const glm::vec3&amp; pos, int width, int height) {
  
      ortho = glm::ortho(0, width, height, 0, 0, 1000);
      this-&gt;position = pos;
      this-&gt;up = glm::vec3(0.0f, 1.0f, 0.0f);
      this-&gt;forward = glm::vec3(0.0f, 0.0f, 1.0f);
  
  }
  </code></pre>
  
  <p>I call this as:</p>
  
  <pre><code>camera = Camera(glm::vec3(0, 0, 2), window-&gt;getSize().x, window-&gt;getSize().y);
  </code></pre>
  
  <p>Where the window is 800 by 600 pixels. I am uploading a transform to the shader via the function:</p>
  
  <pre><code> void Shader::update(const Transform&amp; transform, const Camera&amp; camera) {
  
       glm::mat4 model = camera.getProjection() * transform.getModel();
  
       glUniformMatrix4fv(uniforms[TRANSFORM_U], 1, GL_FALSE, &amp;model[0][0]);
  
   }
  </code></pre>
  
  <p>In which <code>camera.getProjection()</code> is:</p>
  
  <pre><code>glm::mat4 Camera::getProjection() const {
  
      return ortho * glm::lookAt(position, glm::vec3(0, 0, 0), up);
  
  }
  </code></pre>
  
  <p>And <code>transform.getModel()</code> is:</p>
  
  <pre><code>glm::mat4 Transform::getModel() const {
  
      glm::mat4 posMat = glm::translate(pos);
  
      glm::quat rotQuat = glm::quat(glm::radians(rot));
      glm::mat4 rotMat = glm::toMat4(rotQuat);
  
      glm::mat4 scaleMat = glm::scale(scl);
  
      return posMat * rotMat * scaleMat;
  
  }
  </code></pre>
  
  <p>Though I suspect the problem lies in my set up of orthographic projection rather than my transforms, as this worked fine for perspective projection. Can anyone see why the triangle rendered with these coordinates is not visible? I am binding my shader and uploading the projection matrix to it before rendering the mesh. If it helps, my vertex shader is:</p>
  
  <pre><code>#version 120
  
  attribute vec3 position;
  attribute vec2 texCoord;
  
  varying vec2 texCoord0;
  
  uniform mat4 transform;
  
  void main()
  {
      gl_Position = transform * vec4(position, 1.0);
      texCoord0 = texCoord;
  }
  </code></pre>