GL_NORMALIZE

Started by
2 comments, last by Solias 19 years, 4 months ago
Will enabling GL_NORMALIZE compute normals for me and get them of unit length or does it just take normals I've already computed and turn them into unit normals? Thanks.
"We are what we repeatedly do. Excellence, therefore, is not an act, but a habit."-Aristotle
Advertisement
It will not calculate normals for you, just normalize every normal that you feed the pipeline with afaik.
The Red Book states:

Quote:If you perform irregular transformations, or if you specify nonunit-length normals, then you should have OpenGL automatically normalize your normal vectors after the transformations. To do this, call glEnable (GL_NORMALIZE).

If you supply unit-length normals, and you perform only uniform scaling, you can use glEnable (GL_RESCALE_NORMAL) to scale the normals by a constant factor.


And as todderod already stated, you must supply the normals yourself.

So as to your question: the answer is that GL_NORMALIZE will not generate normals, but will normalize the ones you've already provided. Beware that this is done for each new frame you render...

hth
CipherCraft
Quote:Original post by CipherCraft
Beware that this is done for each new frame you render...


If your normals aren't changing every frame you are probably better of normalizing them yourself. Rotation and translation will not affect the length of your normals, but scale will. So if you want to use glScale() with lighting you will need to turn on GL_NORMALIZE.

This topic is closed to new replies.

Advertisement