1

我用 OpenTK 做了一个简单的旋转四面体应用程序。我的问题是最后一张脸不见了。我想是因为我的顶点顺序错误。

        GL.Begin(BeginMode.Triangles);

        GL.Color3(Color.Silver);
        GL.Vertex3(-0.269f, -0.5f, -0.5f);
        GL.Vertex3(0.598f, -0.5f, 0f);
        GL.Vertex3(-0.269f, -0.5f, 0.5f);

        GL.Color3(Color.Honeydew);
        GL.Vertex3(-0.269f, -0.5f, -0.5f);
        GL.Vertex3(0.0f, 0.5f, 0f);
        GL.Vertex3(-0.269f, -0.5f, 0.5f);

        GL.Color3(Color.Moccasin);
        GL.Vertex3(-0.269f, -0.5f, 0.5f);
        GL.Vertex3(0.598f, -0.5f, 0f);
        GL.Vertex3(0.0f, 0.5f, 0f);

        GL.Color3(Color.IndianRed);
        GL.Vertex3(0.598f, -0.5f, 0f);
        GL.Vertex3(-0.269f, -0.5f, 0.5f);
        GL.Vertex3(0.0f, 0.5f, 0f);

        GL.End();

得到四面体的正确顺序是什么?我应该使用另一个 BeginMode 吗?

在此先感谢,丹尼尔

4

1 回答 1

2

如果您在此页面上查找 Tetrahedron::draw() 函数,它会提供似乎对它们有效的坐标和 opengl 调用列表。

即,这种事情:

P1 = {0.0, -1.0, 2.0};
P2 = {1.73205081, -1.0, -1.0};
P3 = {-1.73205081, -1.0, -1.0}
P4 = {0.0, 2.0, 0.0};
coords = {{P1, P2, P3}, {P1, P3, P4}, {P1, P4, P2}, {P2, P4, P3}}
于 2011-03-20T20:04:56.170 回答