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?!).
因此,如果我要使用GL_TRIANGLE_FAN绘制三面金字塔,我为中心提供一个顶点,为底部提供三个顶点(实际上是四个,但你知道我的意思,对吧?!)。
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 ?!).
但是当我只调用一次顶点绘制函数一次时,不知道如何为第一个(中心)顶点分配三次正常(即使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.
将该顶点设置为glNormal3f(0.0f,0.0f,1.0f)是不好的(尽管看起来似乎是正确的),因为这样顶点之间的颜色插值是不正确的。
1 个解决方案
#1
4
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.
因此,不可能只有一个顶点,而是几个法线。这与顶点定义为的方式相矛盾。
#1
4
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.
因此,不可能只有一个顶点,而是几个法线。这与顶点定义为的方式相矛盾。