OpenGL - glVertex replaces drawn points?
In the following OpenGL code, what happens?
glNormal3f( nx1, ny1, nz1 )
glVertex3f( x1,y1,z1 )
glNormal3f( nx2, ny2, nz2 ) //different Normal
glVertex3f( x1,y1,z1 ) //same vector
In words:
I have a point with a normal, If I create the point again with another normal, the point changes his old normal vector, or ignores the last call?This q开发者_开发知识库uestion came about when I was trying to render a sphere with lighting in a smoother way using the normals.
glNormal3f()
just sets the current normal, which will stay that way until the next glNormal3f()
call.
Each glVertex3f()
copies off the current normal, color, and texture coordinates and submits a complete vertex to GL command queue.
It will simply draw both in exactly the same location. There is no magic behind the scenes where points are "recognized" as being in the same location, updating normals and such.
精彩评论