A Little Practice

## Introduction

I think that it is worth spending a little bit of time playing around with the stuff we did in the last tutorial, so I've added this tutorial in here to give you an opportunity to do that. If you want to skip ahead, you won't be missing any new information, so feel free. If you want to try creating something else, feel free to do that too. The important thing is that it is probably worth taking a little bit of time and making sure you're comfortable with the introduction to primitives that we just went through.

What I've done is created a few slightly more sophisticated objects out of triangles below. For each of them, I have included a list of the vertices that you will need to define, a picture of my program for each of them, and also, the code that I made for each of them.

Remember that you need to change the following things:

• The total length of the vertex array, so that it is the correct number of vertices in length
• Create all of the vertices for the object
• In the Draw() method, be sure to draw the correct number of triangles

## Tetrahedron

Faces: 4
Vertices: 12

0.000f, 1.000f, 0.000f
-0.816f, -0.333f, -0.471f
0.000f, -0.333f, 0.943f
0.000f, 1.000f, 0.000f
0.816f, -0.333f, -0.471f
-0.816f, -0.333f, -0.471f
0.000f, -0.333f, 0.943f
0.816f, -0.333f, -0.471f
0.000f, 1.000f, 0.000f
-0.816f, -0.333f, -0.471f
0.816f, -0.333f, -0.471f
0.000f, -0.333f, 0.943f

Faces: 8
Vertices: 24

1, 0, 0
0, -1, 0
0, 0, 1
1, 0, 0
0, 1, 0
0, 0, -1
-1, 0, 0
0, 1, 0
0, 0, 1
-1, 0, 0
0, -1, 0
0, 0, -1
0, 1, 0
1, 0, 0
0, 0, 1
0, 1, 0
-1, 0, 0
0, 0, -1
0, -1, 0
-1, 0, 0
0, 0, 1
0, -1, 0
1, 0, 0
0, 0, -1

## Icosahedron

Faces: 20
Vertices: 60

-0.26286500f, 0.0000000f, 0.42532500f
0.0000000f, -0.42532500f, 0.26286500f
0.26286500f, 0.0000000f, 0.42532500f
-0.26286500f, 0.0000000f, 0.42532500f
-0.42532500f, -0.26286500f, 0.0000000f
0.0000000f, -0.42532500f, 0.26286500f
0.26286500f, 0.0000000f, 0.42532500f
0.0000000f, 0.42532500f, 0.26286500f
-0.26286500f, 0.0000000f, 0.42532500f
0.26286500f, 0.0000000f, 0.42532500f
0.42532500f, 0.26286500f, 0.0000000f
0.0000000f, 0.42532500f, 0.26286500f
0.26286500f, 0.0000000f, 0.42532500f
0.42532500f, -0.26286500f, 0.0000000f
0.42532500f, 0.26286500f, 0.0000000f
-0.26286500f, 0.0000000f, -0.42532500f
0.0000000f, 0.42532500f, -0.26286500f
0.26286500f, 0.0000000f, -0.42532500f
-0.26286500f, 0.0000000f, -0.42532500f
-0.42532500f, 0.26286500f, 0.0000000f
0.0000000f, 0.42532500f, -0.26286500f
-0.26286500f, 0.0000000f, -0.42532500f
-0.42532500f, -0.26286500f, 0.0000000f
-0.42532500f, 0.26286500f, 0.0000000f
0.26286500f, 0.0000000f, -0.42532500f
0.0000000f, -0.42532500f, -0.26286500f
-0.26286500f, 0.0000000f, -0.42532500f
0.26286500f, 0.0000000f, -0.42532500f
0.42532500f, -0.26286500f, 0.0000000f
0.0000000f, -0.42532500f, -0.26286500f
0.0000000f, 0.42532500f, 0.26286500f
0.42532500f, 0.26286500f, 0.0000000f
0.0000000f, 0.42532500f, -0.26286500f
0.0000000f, 0.42532500f, 0.26286500f
-0.42532500f, 0.26286500f, 0.0000000f
-0.26286500f, 0.0000000f, 0.42532500f
0.0000000f, 0.42532500f, -0.26286500f
0.42532500f, 0.26286500f, 0.0000000f
0.26286500f, 0.0000000f, -0.42532500f
0.0000000f, 0.42532500f, -0.26286500f
-0.42532500f, 0.26286500f, 0.0000000f
0.0000000f, 0.42532500f, 0.26286500f
0.0000000f, -0.42532500f, 0.26286500f
0.42532500f, -0.26286500f, 0.0000000f
0.26286500f, 0.0000000f, 0.42532500f
0.0000000f, -0.42532500f, 0.26286500f
-0.42532500f, -0.26286500f, 0.0000000f
0.0000000f, -0.42532500f, -0.26286500f
0.0000000f, -0.42532500f, -0.26286500f
0.42532500f, -0.26286500f, 0.0000000f
0.0000000f, -0.42532500f, 0.26286500f
0.0000000f, -0.42532500f, -0.26286500f
-0.42532500f, -0.26286500f, 0.0000000f
-0.26286500f, 0.0000000f, -0.42532500f
0.42532500f, 0.26286500f, 0.0000000f
0.42532500f, -0.26286500f, 0.0000000f
0.26286500f, 0.0000000f, -0.42532500f
-0.42532500f, 0.26286500f, 0.0000000f
-0.42532500f, -0.26286500f, 0.0000000f
-0.26286500f, 0.0000000f, 0.42532500f

 Having problems with this tutorial? Try the troubleshooting page!