S
S
Sergey2020-10-27 14:24:20
OpenGL
Sergey, 2020-10-27 14:24:20

Roll rotation of OpenGL camera?

I'm trying to rotate the camera around the Z axis, that is, Roll rotation.

float rad = org.joml.Math.toRadians(angle);
upVector.x = 0;
upVector.y = 1;
upVector.z = 0;
upVector.x = (float)Math.cos(rad);
upVector.y = (float)Math.sin(rad);
camera = camera.lookAt(camPos, front, upVector);

And everything rotates normally, as long as the center of the object is at point 0, but if you move it somewhere with the help of a model matrix, then the camera begins to rotate not around its axis, but around the center. I'm using OpenGL 3 version, what is the correct way to rotate in Z axis?
The camera is at the point 0, 0, 0 , that is, I do not rotate it anywhere.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question