Since OpenGL camera basically looking at negative z direction,
int front = 0, right = 0;
// Press W and move backward?!
front += glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS ? -1 : 0;
front += glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS ? 1 : 0;
// Press D to move right makes sense!
right += glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS ? 1 : 0;
right += glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS ? -1 : 0;
Translate(right, 0, front);
As you can see in the code, in order to move camera forward, I have to move it's z position backward, which completely disobeys my intuition.
So in order to deal with this problem, I deliberately multiplied scale(1, 1, -1) to my view matrix, like
viewMatrix = glm::inverse(GetWorldTransform());
viewMatrix = glm::scale(glm::mat4(1), glm::vec3(1, 1, -1)) * viewMatrix;
pvMatrix = perspectiveMatrix * viewMatrix;
...Which is not very pretty. Is it okay to solve this problem like this? Or, Is there any way to set OpenGL's camera to look at positive z direction? Or, Is there a prettier way to deal with the problem?