Say we do this:
glm::mat4 View = glm::lookAt(glm::vec3(4,3,-3), glm::vec3(0,0,0),glm::vec3(0,1,0));
And after printing to the console with glm tostring (column major order):
View = -0.600000 -0.411597 0.685994 0.000000
0.000000 0.857493 0.514496 0.000000
-0.800000 0.308697 -0.514496 0.000000
-0.000000 -0.000000 -5.830953 1.000000
This matrix works as intended. I multiplied it by a perspective projection matrix and passed the resulting matrix in to my vertex shader to be multiplied by the vertices of a cube with side length = 1. So the full expression for each projected vertex is:
VERTEX VIEW PERSPECTIVE PROJECTION
p.x -0.600000 -0.411597 0.685994 0.000000 0.629325 0.000000 0.000000 0.000000
p.y * 0.000000 0.857493 0.514496 0.000000 * 0.000000 0.839100 0.000000 0.000000
p.z -0.800000 0.308697 -0.514496 0.000000 0.000000 0.000000 -1.002002 -1.000000
1.0 -0.000000 -0.000000 -5.830953 1.000000 0.000000 0.000000 -0.200200 0.000000
Which produces this:
However, I was under the impression that to account for the translation of the camera, the camera's coordinates should be inverted and placed in the fourth column of the View Matrix. So I tried this:
VERTEX VIEW PERSPECTIVE PROJECTION
p.x -0.600000 -0.411597 0.685994 -4.000000 0.629325 0.000000 0.000000 0.000000
p.y * 0.000000 0.857493 0.514496 -3.000000 * 0.000000 0.839100 0.000000 0.000000
p.z -0.800000 0.308697 -0.514496 3.000000 0.000000 0.000000 -1.002002 -1.000000
1.0 -0.000000 -0.000000 -0.000000 1.000000 0.000000 0.000000 -0.200200 0.000000
Which produces this:
Why does the first View Matrix work but not the second one?