# 3D Triangle.

Okay, changing cube to a 3D Triangle(What are they called???)

Can anyone tell me if this data works, and what order I should draw the triangles?(right now, it’s not all joining together
)

typedef GLfloat Point3D[3];

Point3D BottomTri[3] =
{
{-1.75, -1.75, 1.0},
{1.75, -1.75, 1.0},
{0.0, -1.75, -1.0}
};

Point3D BackLeftTri[3] =
{
{0.0, -1.75, -1.0},
{0.0, 1.75, 0.0},
{-1.75, -1.75, 1.0}
};

Point3D BackRightTri[3] =
{
{0.0,-1.75, -1.0},
{0.0, 1.75, 0.0},
{1.75, -1.75, 1.0}
};

Point3D FrontTri[3] =
{
{-1.75, -1.75, 1.0},
{1.75, -1.75, 1.0},
{0.0, 1.75, 0.0}
};

I’m drawing the data in a display list that goes like:
glBegin(GL_TRIANGLES);
//Bottom Triangle display
//Back Left Triangle Display
//Back Right Triangle Display
//Front Triangle Display
glEnd();

A cube has 6 faces so you need 12 triangles.
2 triangles for each face.

I don’t see this in your code.

Perhaps I’m just misunderstanding you here: are you trying to draw a pyramid?

If so, your code looks fine to me. Also, it wouldn’t really matter what order you drew the triangles in anyway, as long as you don’t do transformations between draws.

Chris

I guess I did not understand what you meant by 3D triangle.

A pyramid is formed by a quad on the bottom and 4 lateral triangles. So to do this with you need two triangles on the bottom plus 4 triangles so thats 6 triangles for all.

However, if you want to do a tetrahedral solid. It is formed by four triangles.

I think you better explain what you mean by 3D triangle.

Found it! Tetrahedron
Four triangles, making a sort of ‘half-pyramid’ shape.

That is, half-pyramid as if cut diagonally.

[This message has been edited by Dire_Avenger (edited 01-31-2001).]

And incindentally, according to Webster’s, a pyramid can have any sort of poly as a base - squares are just the most common.

Chris