PDA

View Full Version : scaling affect the lighting on object??



somnath
05-10-2011, 09:59 AM
hello
i m trying to do scaling on object ..where GL_LIGHTING is enabled .....scaling changes the color and its apperance ...


plz tell me how to rectify dis prob
thanks

BionicBytes
05-10-2011, 12:16 PM
You are probably using glScalef command which will also scale your normals. If you are using a shader then ensure you renormalise them on the vertex shader. For fixed function rendering you can use glEnable (GL_NORMALIZE)

McLeary
05-12-2011, 01:39 PM
Even using fixed function pipeline, rescaling normals generates some odd results.
Enable GL_NORMALIZE and be happy.

Kopelrativ
05-13-2011, 04:01 AM
If you scale differently in x, y and z, then it is not enough to renormalize using GL_NORMALIZE (except when normals are parallel to scaling axis). I think GL_RESCALE_NORMAL can handle this?

Dark Photon
05-13-2011, 05:25 PM
If you scale differently in x, y and z, then it is not enough to renormalize using GL_NORMALIZE (except when normals are parallel to scaling axis). I think GL_RESCALE_NORMAL can handle this?
I think that's backwards. RESCALE_NORMAL handles uniform scales. NORMALIZE handles that and non-uniform scales as well.

somnath
05-14-2011, 10:52 PM
thanks alot glEnable (GL_NORMALIZE) works good