OGL自动纹理坐标生成的一点疑惑
最近在做Project Texture的时候遇到了一点问题,所以非常想知道纹理坐标自动生成的本质。
在OGL REDBOOK中是这样描述用GL_EYE_LINEAR模式来生成纹理坐标的:
Sometimes you'd like the contour lines to be calculated relative to the eye's coordinate system. In other words, you want to multiply the vector (p1p2p3p4) by the inverse of the modelview matrix before calculating the distance to the plane. If you specify GL_TEXTURE_GEN_MODE with GL_EYE_LINEAR, this is exactly what happens. The texture coordinate is generated with the following function:
generated coordinate = p1'xe + p2'ye + p3'ze + p4'we
where (p1' p2' p3' p4') = (p1p2p3p4)M-1
In this case, (xe, ye, ze, we) are the eye coordinates of the vertex, and p1, ..., p4 are supplied as the param argument to glTexGen*() with pname set to GL_EYE_PLANE.
其中
(Xe, Ye, Ze, We)是眼坐标系中的顶点坐标,也就是经过了模型视图变换后的顶点坐标吧。
(M-1)是模型视图矩阵的逆矩阵。
那么(M-1)(Xe, Ye, Ze, We)的本质是将模型的顶点坐标变换到最初始时的位置。
那这样实际上不就是GL_OBJECT_LINEAR模式了吗?
不知道是REDBOOK写错了还是我的理解有误。 :(