N.Peart
N.Peart

Reputation: 45

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 question came about when I was trying to render a sphere with lighting in a smoother way using the normals.

Upvotes: 0

Views: 494

Answers (2)

genpfault
genpfault

Reputation: 52084

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.

Upvotes: 1

Bart
Bart

Reputation: 20030

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.

Upvotes: 0

Related Questions