سؤال

I made a simple spinning tetrahedron application with OpenTK. My problem is that the last face is missing. I guess because I'm making a wrong order of vertices.

        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();

What is the correct order to get the tetrahedron? Should I use another BeginMode?

Thanks in advance, Daniel

هل كانت مفيدة؟

المحلول

if you look for the Tetrahedron::draw() function on this page it provides a list of coords and opengl calls that seem to be working for them.

Namely, this kind of thing:

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}}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top