scaling destroys lighting of glutSolidSphere

if you scale a sphere created with glutSolidSphere using glScale, the lighting gets ruined. But if you scale your glutSolidSphere via parameter (radius) then everything is fine and lighting is perfect.

Unfortunately, scaling with the radius won’t make your sphere stretch along a specific axis (to form something like an ellipsoid).

so I would assume that glScale is the only answer? if so, then how do you use glScale without ruining the normals defined inside the glutSolidSphere function?

if this approach is not possible, then how would you rewrite glutSolidSphere to be more flexible such that you can scale along a specific axis via paramters:

glutSolidEllipsoid(x_axis, y_axis, z_axis);

Shogo2040

Using glScale is always a problem with lighting, because the normal vectors get also scaled. And those are used to calculate the lighting. You can activate normalization with glEnable(GL_NORMALIZE), but that will slow down your app dramatically. The best thing is not to use glScale, but do the scale in geometry (like adjusting the radius of your sphere).

Kilam.

You can use GL_EXT_rescale_normal (if available).