PDA

View Full Version : VBO's and normals



Nyad
11-05-2007, 10:30 AM
In nehe tuts when they do lighting they only give one
normal per face.

But is this the same with vbo's or must I give one normal per vert?

yalmar
11-05-2007, 12:44 PM
somebody tell me to use GL_FLAT but i don't get good results.
Also, i would like know how to render in FLAT mode with VBOs

Cgor_Cyrosly
11-05-2007, 01:05 PM
In nehe tuts when they do lighting they only give one
normal per face.

But is this the same with vbo's or must I give one normal per vert?
Not same, per vertext may be has more than one normals unless all primitives have the same coefficients of plane equation

Relic
11-06-2007, 05:10 AM
In nehe tuts when they do lighting they only give one
normal per face.

But is this the same with vbo's or must I give one normal per vert?

VBOs are based on vertex arrays and if you have a normal array specified it has to have the same number of attributes as the vertex array, that is one normal per vertex (for all cases below:)

If you want to have face normals, you need to specify independent primitives (duplicating vertices if required) and all vertices of one primitive should get the same normal attribute in the normal array.

If you use glShadeModel(GL_FLAT), OpenGL uses only one normal per sub-primitive to calculate the color for the whole sub-primitive. Normally that's the last normal of a subprimitive, except for GL_POLYGON where it's the first.
Yeah, interpretation potential for GL_POINTS, I know. ;)

The resulting image will not be the same because lighting in the "face normal" case (e.g. same normal for all three vertices of a triangle) will more accurately represent specular lighting and local viewer than glShadeModel(GL_FLAT).