title: OpenGL program /w shaders, camera not moving correctly
body: <p>My experience with openGL is not great so some of this may seem sloppy to you, but I have a project where I use opengl to render an object in using my own shaders. I then should be able to free roam with the camera around the object using my mouse and WASD keys.  I can not see the object and my keys and mouse are not affecting the object. I have been staring at this for hours changing small things here and there but nothing seems to be working I really need a new pair of eyes to look at this. I understand that vmath is old and glut is old but this is what our professor wants us to use.
  These are my peices of code that I believe the problem is located.
  This is my main:</p>
  
  <pre><code>int main(int argc, char **argv)
  {
  
      glutInit(&amp;argc, argv);
  
      glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
      glutInitWindowPosition((glutGet(GLUT_SCREEN_WIDTH) - 750) / 2, (glutGet(GLUT_SCREEN_HEIGHT) - 750) / 2);
      glutInitWindowSize(width, height);
      glutCreateWindow("Assignment Two");
  
      glewExperimental = GL_TRUE;
      glewInit();
  
      glViewport(0, 0, width, height);
  
      glutPassiveMotionFunc(mouseMove);
      glutKeyboardFunc(keyboard);
      glutDisplayFunc(display);
      glutIdleFunc(display);
      glEnable(GL_DEPTH_TEST);
  
      glGenVertexArrays(1, &amp;VAO);
      glGenBuffers(1, &amp;VBO);
      glBindVertexArray(VAO);
  
      glBindBuffer(GL_ARRAY_BUFFER, VBO);
      glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
  
      glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);
      glEnableVertexAttribArray(0);
      glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3 * sizeof(GLfloat)));
      glEnableVertexAttribArray(2);
  
      glBindVertexArray(0);
  
      glutMainLoop();
      return 1;
  }
  </code></pre>
  
  <p>This is my display function which is used in the glut idle and display function: </p>
  
  <pre><code>void display()
  {
      Shader ourShader("Shader.vs", "Shader.frag");
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
      ourShader.Use();
      vmath::mat4 view;
      view = vmath::lookat(cPosition, cFront + cPosition, cUp);
      vmath::mat4 projection;
      projection = vmath::perspective(45.0f, (GLfloat)width / (GLfloat)height, nearC, farC);
  
      GLint modelLoc = glGetUniformLocation(ourShader.Program, "model");
      GLint viewLoc = glGetUniformLocation(ourShader.Program, "view");
      GLint projLoc = glGetUniformLocation(ourShader.Program, "projection");
  
      glUniformMatrix4fv(viewLoc, 1, GL_FALSE, view);
      glUniformMatrix4fv(projLoc, 1, GL_FALSE, projection);
  
      glBindVertexArray(VAO);
      for (GLuint i = 0; i &lt; 10; i++)
      {
          vmath::mat4 model;
          model *= vmath::translate(cubePositions[i]);
          GLfloat angle = 20.0f * i;
          model *= vmath::rotate(angle, cubePositions[i]);
          glUniformMatrix4fv(modelLoc, 1, GL_FALSE, model);
  
          glDrawArrays(renderType, 0, 36);
      }
      glBindVertexArray(0);
  
      glFlush();
      glutSwapBuffers();
  }
  </code></pre>
  
  <p>This is keyboard which is called in my glutkeyboardfunc:</p>
  
  <pre><code>void keyboard(unsigned char key, int xx, int yy)
  {
      GLfloat cameraSpeed = 0.01f;
      int i, j;
      std::string userInput;
      if (key == 'q' || key == 'Q')
      {
          glDeleteVertexArrays(1, &amp;VAO);
          glDeleteBuffers(1, &amp;VBO);
          exit(0);
      }
      else if (key == 'w' || key == 'W')
      {
          cPosition += cameraSpeed * cFront;
      }
      else if (key == 's' || key == 'S')
      {
          cPosition -= cameraSpeed * cFront;
      }
      else if (key == 'a' || key == 'A')
      {
          cPosition -= vmath::normalize(vmath::cross(cFront, cUp)) * cameraSpeed;
      }
      else if (key == 'd' || key == 'D')
      {
          cPosition += vmath::normalize(vmath::cross(cFront, cUp)) * cameraSpeed;
      }
  }
  </code></pre>
  
  <p>Then this is my mouseMove function which is called in my glutPassiveMotionFunc:</p>
  
  <pre><code>void mouseMove(int posX, int posY)
  {
      GLfloat xOffset;
      GLfloat yOffset;
      GLfloat sensitivity = 0.2f;
      if (firstTime)
      {
          lastX = (float)posX;
          lastY = (float)posY;
          firstTime = false;
      }
      xOffset = posX - lastX;
      yOffset = lastY - posY;
      lastX = (GLfloat)posX;
      lastY = (GLfloat)posY;
  
      xOffset *= sensitivity;
      yOffset *= sensitivity;
  
      yaw += xOffset;
      pitch += yOffset;
  
      if (pitch &gt; 89.0f)
      {
          pitch = 89.0f;
      }
      if (pitch &lt; -89.0f)
      {
          pitch = -89.0f;
      }
  
      vmath::vec3 front;
      front[0] = (GLfloat)(cos((M_PI / 180)*yaw) * cos((M_PI / 180)*pitch));
      front[1] = (GLfloat)(sin((M_PI / 180)*pitch));
      front[2] = (GLfloat)(sin((M_PI / 180)*yaw) * cos((M_PI / 180)*pitch));
      cFront = vmath::normalize(front);
  }
  </code></pre>
  
  <p>here is my Shader.vs:</p>
  
  <pre><code>layout (location = 0) in vec3 position;
  
  uniform mat4 model;
  uniform mat4 view;
  uniform mat4 projection;
  
  void main()
  {
      gl_Position = projection * view * model * vec4(position, 1.0f);
  }
  </code></pre>
  
  <p>I'm thinking there has to be an error in the fact that something is not being changed correctly, or it is not updating correctly. Let me know if you would like me to post anything or let you know about anything else with my code.</p>