I am new to OpenGl. Now I am learning it and try to draw a sphere with lightening effect. It works very well but when I apply the scaling factor (scalef) to enlarge the sphere. The lightening effect is too weak and it is too strong when i shrink the sphere.
Can anyone tell me how to enlarge and shrink the sphere with exactly the same lightening effect as without scaling??
Use glEnable(GL_NORMALIZE) so that OpenGL will re-normalize your normals once you scale them.
Be aware, GL_NORMALIZE will incur a lot of overhead. I ran into the same problem and I was able to get it to work by pre-multiplying my unit normals by 1/scale. If you do the math, you will see that this will result in transformed unit normals. ( Take a look at the red book for the transformation equations)
>> Use glEnable(GL_NORMALIZE) so that OpenGL will re-normalize your normals once you scale them.