Trying To Rotate Camera along World Axis


I’m trying to rotate the camera position that’s then used for glm::lookAt along x and y axis.

I read online somewhere that in order to do this you have to translate to the Center, rotate then translate back. My problem when I try this is that the camera is also zooming out. This is how I’m executing this:

void camera::rotateRight()
vec3 toCenter = (vec3(0, 0, 1) - this->pos);

this->pos = this->pos + toCenter;
this->pos = glm::rotate(this->pos, glm::radians(10.f), vec3(0, 1, 0));
this->pos = this->pos - toCenter;

(0,0, 1) is the initial position of the camera. this->pos is the current position of the camera.