title: Applying Camera Transformations to OpenGL
body: <p>I'm attempting to create a Camera class for a 3D OpenGL project. However I cannot figure out how to actually apply the camera to my scene. I have these Camera functions (amongst others):</p>
  
  <pre><code>void Camera::update(){
      glm::vec3 direction(cos(_verticalAngle) * sin(_horizontalAngle), sin(_verticalAngle), cos(_verticalAngle) * cos(_horizontalAngle));
  
      glm::vec3 right = glm::vec3(sin(_horizontalAngle - 3.14f/2.0f), 0, cos(_horizontalAngle - 3.14f/2.0f));
  
      glm::vec3 up = glm::cross(right, direction);
  
      _projectionMatrix = glm::perspective(_FoV, float(VIEWPORT_X) / float(VIEWPORT_Y), 0.1f, 250.0f);
      _viewMatrix = glm::lookAt(_position, _position + direction, up);
  }
  glm::mat4 Camera::getProjectionMatrix(){
      return _projectionMatrix;
  }
  glm::mat4 Camera::getViewMatrix(){
      return _viewMatrix;
  }
  </code></pre>
  
  <p>They were created from a tutorial, I'm not sure if they work though since I can't test them. What I want to do is get OpenGL to use the view and projection matrices to simulate a camera. How exactly do I tell OpenGL to use those projection and view matrices, so that it properly simulates a camera separate from model's transformations? I'm aware OpenGL will not accept glm matrices by default, but I have seen this type of thing in a few tutorials:</p>
  
  <pre><code>glm::mat4 ProjectionMatrix = getProjectionMatrix();
  glm::mat4 ViewMatrix = getViewMatrix();
  glm::mat4 ModelMatrix = glm::mat4(1.0);
  glm::mat4 MVP = ProjectionMatrix * ViewMatrix * ModelMatrix;
  
  glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &amp;MVP[0][0]);
  </code></pre>
  
  <p>but glUniformMatrix4fv (which I think applies the camera transforms?) makes no sense to me. It always has something to do with shaders, which I have none of. I simply have a wireframe test mesh currently. Could someone provide me a code snippet for this problem?</p>