PDA

View Full Version : about the glNormal



zydgyy
11-25-2011, 01:32 AM
Hi,i ame newbie to computer graphic!
I read about glNormal is used between glBegin,glEnd,i wonder if a call glNormal,then glVertex mutilple times,then this normal is assigned all these vertices or just assigned the poloygon cosists of them?I cofused that what the relationship between vertex and normal,poloygon,the normal is belong to vertex or to poloygon,THANKS!

V-man
11-25-2011, 01:55 AM
Behind the scenes, GL will generate a buffer. It will assign a normal for each vertex. It will upload to the GPU and it will setup the GPU and then it will press the start render button on the GPU.

mhagain
11-25-2011, 03:57 AM
glNormal, like glTexCoord, glColor, etc doesn't really do much on it's own. All that happens is that it updates an internal "current normal" value (or current texcoord, etc). When you call glVertex these current values are collected, together with the position you've specified, and used to create all attributes of the vertex. (That's why glVertex should always come last, by the way.)

Because of this it's quite legal to call glNormal, glTexCoord, etc (but not glVertex; not sure if it throws an error but it's certainly meaningless) outside of a glBegin/glEnd pair if you wish, but you normally see them inside.