Zooming and clipping


i’ am using gluPerspective to setup the projection-matrix and gluLookAt to position the camera. When i perform a zoom, i modify the distance between eye-point and reference-point (both parameters for gluLookAt). When the distance is less or equal to the boundingsphere-radius, the objects will be partially clipped, so that i can look inside, what looks terrible. Is there a way, that i can zoom without the described effect ?

The object is being clipped by the near plane, and there’s no way to stop it from being clipped. All you can do to prevent it, is stop zooming when you are close enough.

You don’t want to look inside, do you?

Maybe you can test the distance beetwen the camera and the object and don’t allow to go ahead if it is less than the bounding-radius.

Is it what you where asking?


eh? zomming has nothing to do with the clipping planes!

this is the matrix: (perspective, lefthanded, postmultiplied)
A 0 0 0
0 B 0 0
0 0 C D
0 0 1 0

A = 1.0 / tan(Angle / 2.0 / 180.0 * M_PI) / Aspect
B = 1.0 / tan(Angle / 2.0 / 180.0 * M_PI)
C = (Far + Near) / (Far - Near)
D = -2.0 * Far * Near / (Far - Near)

Near = near clipping plane
Far = far clipping plane
Angle = opening angle of the ‘camera’ (zoom)
Aspect = aspect ratio of the screen (normally 4.0/3.3)