简体   繁体   中英

GL_TRIANGLE_FAN first (center) vertex normal

So if I'm to draw three-sided pyramid with GL_TRIANGLE_FAN I provide one vertice for center and three for bottom (actually four but you know what I mean, right?!).

I can calculate face normals for all three faces (sides) of pyramid.

Question is how can I assign different normal to the first (center) vertice for every face (side) if I have only one call to draw that vertice ?

Basically I need to assign same face normal to all three vertices that compose triangle and than same thing for next two triangles.

But don't know how to assigne normal for the first (center) vertice three times when I call that vertice draw function only once (is that even possible with GL_TRIANGLE_FAN ?!).

Setting that vertice normal to glNormal3f(0.0f, 0.0f, 1.0f) is no good (though it seems correct) because that way color interpolation between vertices is not correct.

It's a common misconception that a vertex is just the position. A vertex is the whole set of position, normal, texture coordinates, and so on. If you change only one attribute of the vertex vector, you get a very different vertex.

Hence it is not possible to have only one vertex, but several normals. This contradicts the very way a vertex is defined as.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM