I just started implementing skyboxes and am doing this with OpenGL / GLSL and GLM as my math library. I assume the problem is with the matrix, and I could not find an implementation that uses the GLM library:
The skybox model loads just fine, the camera, however, twists it, as if it rotated around it in a third-party 3d camera.
For my skybox matrix, I update it every time my camera updates. Since I use glm :: lookAt, it is essentially created in the same way as my view matrix, except that I use 0, 0, 0 for direction.
Here is my view matrix creation. It works great when rendering objects and geometry:
direction = glm::vec3(cos(anglePitch) * sin(angleYaw), sin(anglePitch), cos(anglePitch) * cos(angleYaw)); right = glm::vec3(sin(angleYaw - 3.14f/2.0f), 0, cos(angleYaw - 3.14f/2.0f)); up = glm::cross(right, direction); glm::mat4 viewMatrix = glm::lookAt(position, position+direction, up);
Similarly, my sky matrix is โโcreated in the same way with just one change:
glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f); glm::mat4 skyView = glm::lookAt(position, position + direction, up);
I know that skybox does not apply translation and only considers rotations, so I'm not sure what the problem is. Is there an easier way to do this?
Visual aids:
Straight without moving 
When I rotate the camera: 
My question is this: how to set up the correct matrix for rendering skybox using glm: lookAt?