PDA

View Full Version : what is glNormalf ?



des
02-05-2006, 06:08 PM
Hi all!
Sorry for my English. U hope you'll understand something.

What is normalie? As I realy should use glNormalf to make my polygons look correctly or it can be done automaticaly by using something. And what is glEnable(GL_NORMALIZE) how it change my polygons

Rodrix
02-05-2006, 06:57 PM
glNormalf is a command for establishing the normal of the polygon you are going to draw next.
In other words you should call it before drawing each polygon.

Once you use lighting in OpenGl you'll have to use normals. Without normals opengl doesnt know how to shade.

Either you can manually calculate the normals (vector math) or you can load them from a program that already calculates them, for example 3d studio, etc. However you'll have to code a way to parse a 3d studio file.

glEnable(GL_Normalize) normalizes the normal vectors for you with a small performance hit. Normals should be normalized (that is norm =1 ), if not shading looks bad.

I hope you get the idea.

:)

mikael_aronsson
02-06-2006, 12:10 AM
The normal points in the direction of the "surface" of the polygon, if you want to calculate it yourself you use something called Cross product (http://en.wikipedia.org/wiki/Cross_product)

http://upload.wikimedia.org/wikipedia/en/d/df/Crossproduct.png