title: Opengl Vertices Camera orientation
body: <p>I am working on a 3D project using vertices, i started it with a simple gluLookAt in order to have a first person camera moving in an environment, i use it this way :</p>
  
  <pre><code>   gluLookAt(_position.x,_position.y,_position.z,
        _target.x,_target.y,_target.z,
        0,0,1);
  </code></pre>
  
  <p>Everything was working fine, i was calculating my target according to the position of the mouse and angles (theta and phi), my project moved on to using vertices for performance issues, so i had to use the same camera for these new objects, in order to do this i used the GLM library this way :</p>
  
  <pre><code>glm::mat4 Projection = glm::perspective(90.0f, 800.0f / 600.0f, 0.1f, 100.f);
  glm::mat4 View = glm::lookAt(
  glm::vec3(position.x,position.y,position.z),
  glm::vec3(target.x,target.y,target.z), 
  glm::vec3(0,0,1)  
      );
  
  glm::mat4 Model = glm::mat4(1.0f); !
  // Our ModelViewProjection : multiplication of our 3 matrices
  glm::mat4 MVP = Projection * View * Model; 
  
  GLuint MatrixID = glGetUniformLocation(this-&gt;shaderProgram, "MVP");
  </code></pre>
  
  <p>here is the shader i use :</p>
  
  <pre><code>const GLchar* default_vertexSource =
  "#version 150 core\n"
  "in vec2 position;"
  "in vec3 color;"
  "out vec3 Color;"
  "uniform vec3 translation;"
  "uniform mat4 rotation;"
  "uniform mat4 MVP;"
  "void main() {"
  "   Color = color;"
  "   gl_Position = MVP*rotation*vec4(position.x + translation.x, position.y + translation.y, 0.0 + translation.z, 1.0);"
  "}";
  </code></pre>
  
  <p>What happens is that my my object's coordinate reference is not the same as my camera, it is drawn above it on the current x/z plan whereas it should be facing the camera on the x/y plan.</p>