@keskiverto
"degrees" meant to be what can see with the camera UP and DOWN...
if I say in radians then I should have said PI/4 ... bullshit
with that shit tutorial you didn't helped me
my camera is good but with if the direction {x,1,x} it can be only 45 degrees (what we can see...)
but agian I want UP and DOWN 90 degrees (what we can see with the camera)
after I slept a big I got an idea and I solved with an easy move...
and I won't show in the next code but UP and DOWN shouldn't be fully 90 degrees so I just limited to "89.95f"
1 2 3 4
cam_dir[1]=sinf(math_rad(cam_rot[1]));//cam_rot[1] max 89.95f min -89.95f
cam_dir[0]=cosf(math_rad(cam_rot[0]))*(1-math_abs(cam_dir[1]));
cam_dir[2]=sinf(math_rad(cam_rot[0]))*(1-math_abs(cam_dir[1]));
You have two positions: Center and Eye. Eye is at fixed distance from Center.
You have direction: Up. You also have direction toCamera, which is like from Center to Eye. (Eye == Center + toCamera)
At start the toCamera and Up are perpendicular.
You want to be able to rotate around axis that is perpendicular to both toCamera and Up, i.e. around normal of a plane defined by those two directions. We could call that direction Axis. Cross-product of normalized toCamera and Up.
You want to limit the rotation, so you have to keep the original toCamera and Up and an Angle. The Center does not change.
So, you do decide an Angle. Then you can calculate rotation R. Now you can compute Eye' = R * toCamera + Center, and Up' = R * Up. Then you can feed Center, Eye', and Up' into gluLookAt().
Alternatively, you use glRotate() with Axis and Angle. Obviously, if Center is not {0,0,0}, some glTranslate is required too.
Is this a semi-accurate description of your problem?