为 openGL 提供 3D 坐标的顺序是什么?
我希望有人能为我阐明这个问题。如果给我一个点 (i, j, k),我可以制作以下立方体:
8______K_______7 1 = i , j , k
/| /| 2 = i+1, j , k
L/ | J/ | 3 = i+1, j+1, k
/ |H / | 4 = i , j+1, k
5/______I_____/6 |G 5 = i , j , k+1
| | | | 6 = i+1, j , k+1
| | | | 7 = i+1, j+1, k+1
E| 4|________|F__|3 8 = i , j+1, k+1
| / c | /
| /D | /B
|/___________|/
1 A 2
其中数字 1-8 是立方体的每个顶点,字母 AL 是立方体每条边的中点。
我正在尝试实现行进立方体算法,但我不知道为我找到的每个三角形平面给出点的顺序。例如,如果标记了顶点 1,那么我需要从 EDA 绘制一个平面。同样,如果标记了顶点 7,我需要从 KJG 绘制一个平面。 openGL 3D 空间中给出坐标的顺序有规则吗?
I am hoping someone can shed some light on this issue for me. If I am given a point (i, j, k), I can make the following cube:
8______K_______7 1 = i , j , k
/| /| 2 = i+1, j , k
L/ | J/ | 3 = i+1, j+1, k
/ |H / | 4 = i , j+1, k
5/______I_____/6 |G 5 = i , j , k+1
| | | | 6 = i+1, j , k+1
| | | | 7 = i+1, j+1, k+1
E| 4|________|F__|3 8 = i , j+1, k+1
| / c | /
| /D | /B
|/___________|/
1 A 2
where the numbers 1-8 are each of the cube's vertices and the letters A-L are the midpoints of each edge of the cube.
I am trying to implement a marching cube algorithm, but I do not know what order to give the points for each triangular plane I find. For example, if vertex 1 is marked, then I would need to draw a plane from E-D-A. Similarly, if vertex 7 is marked I would need to draw a plane from K-J-G. Is there a rule for the order to give coordinates in 3D space for openGL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OpenGL 通过屏幕空间中顶点的缠绕来定义面的正面和背面。如果屏幕空间中面的顶点按逆时针顺序排列,则正面被视为可见。顺时针顺序=>背面。法线应指向正面方向。
OpenGL defines front and back side of a face by the winding of the vertices in screen space. If the vertices of a face in screen space are in counterclock order, the front face is considered visible. Clockwise order => backface. Normals should point into front face direction.