PDA

View Full Version : scalef problem



11-17-2001, 10:41 AM
hi,
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??

Thanks,

M&M

Korval
11-17-2001, 11:57 AM
Use glEnable(GL_NORMALIZE) so that OpenGL will re-normalize your normals once you scale them.

dslater
11-19-2001, 08:49 PM
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.