11 min read

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:

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

Tetrahedron

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace DrawingTriangles
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        VertexBuffer vertexBuffer;

        BasicEffect basicEffect;
        Matrix world = Matrix.CreateTranslation(0, 0, 0);
        Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 3), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 480f, 0.01f, 100f);
        double angle = 0;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            basicEffect = new BasicEffect(GraphicsDevice);

            VertexPositionColor[] vertices = new VertexPositionColor[12];
            vertices[0] = new VertexPositionColor(new Vector3(0.000f, 1.000f, 0.000f), Color.Red);
            vertices[1] = new VertexPositionColor(new Vector3(-0.816f, -0.333f, -0.471f), Color.Blue);
            vertices[2] = new VertexPositionColor(new Vector3(0.000f, -0.333f, 0.943f), Color.Green);
            vertices[3] = new VertexPositionColor(new Vector3(0.000f, 1.000f, 0.000f), Color.Red);
            vertices[4] = new VertexPositionColor(new Vector3(0.816f, -0.333f, -0.471f), Color.Yellow);
            vertices[5] = new VertexPositionColor(new Vector3(-0.816f, -0.333f, -0.471f), Color.Blue);
            vertices[6] = new VertexPositionColor(new Vector3(0.000f, -0.333f, 0.943f), Color.Green);
            vertices[7] = new VertexPositionColor(new Vector3(0.816f, -0.333f, -0.471f), Color.Yellow);
            vertices[8] = new VertexPositionColor(new Vector3(0.000f, 1.000f, 0.000f), Color.Red);
            vertices[9] = new VertexPositionColor(new Vector3(-0.816f, -0.333f, -0.471f), Color.Blue);
            vertices[10] = new VertexPositionColor(new Vector3(0.816f, -0.333f, -0.471f), Color.Yellow);
            vertices[11] = new VertexPositionColor(new Vector3(0.000f, -0.333f, 0.943f), Color.Green);

            vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 12, BufferUsage.WriteOnly);
            vertexBuffer.SetData<VertexPositionColor>(vertices);
        }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            angle += 0.01f;
            view = Matrix.CreateLookAt(
                new Vector3(5 * (float)Math.Sin(angle), -2, 5 * (float)Math.Cos(angle)),
                new Vector3(0, 0, 0),
                Vector3.UnitY);

            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            basicEffect.World = world;
            basicEffect.View = view;
            basicEffect.Projection = projection;
            basicEffect.VertexColorEnabled = true;

            GraphicsDevice.SetVertexBuffer(vertexBuffer);

            RasterizerState rasterizerState = new RasterizerState();
            rasterizerState.CullMode = CullMode.None;
            GraphicsDevice.RasterizerState = rasterizerState;

            foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 12);
            }

            base.Draw(gameTime);
        }
    }
}

Octahedron

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

Octahedron

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace DrawingTriangles
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        VertexBuffer vertexBuffer;

        BasicEffect basicEffect;
        Matrix world = Matrix.CreateTranslation(0, 0, 0);
        Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 3), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 480f, 0.01f, 100f);
        double angle = 0;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            basicEffect = new BasicEffect(GraphicsDevice);

            VertexPositionColor[] vertices = new VertexPositionColor[24];
            vertices[0] = new VertexPositionColor(new Vector3(1, 0, 0), Color.Red);
            vertices[1] = new VertexPositionColor(new Vector3(0, -1, 0), Color.Green);
            vertices[2] = new VertexPositionColor(new Vector3(0, 0, 1), Color.Blue);
            vertices[3] = new VertexPositionColor(new Vector3(1, 0, 0), Color.Red);
            vertices[4] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Green);
            vertices[5] = new VertexPositionColor(new Vector3(0, 0, -1), Color.Blue);
            vertices[6] = new VertexPositionColor(new Vector3(-1, 0, 0), Color.Red);
            vertices[7] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Green);
            vertices[8] = new VertexPositionColor(new Vector3(0, 0, 1), Color.Blue);
            vertices[9] = new VertexPositionColor(new Vector3(-1, 0, 0), Color.Red);
            vertices[10] = new VertexPositionColor(new Vector3(0, -1, 0), Color.Green);
            vertices[11] = new VertexPositionColor(new Vector3(0, 0, -1), Color.Blue);
            vertices[12] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Red);
            vertices[13] = new VertexPositionColor(new Vector3(1, 0, 0), Color.Green);
            vertices[14] = new VertexPositionColor(new Vector3(0, 0, 1), Color.Blue);
            vertices[15] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Red);
            vertices[16] = new VertexPositionColor(new Vector3(-1, 0, 0), Color.Green);
            vertices[17] = new VertexPositionColor(new Vector3(0, 0, -1), Color.Blue);
            vertices[18] = new VertexPositionColor(new Vector3(0, -1, 0), Color.Red);
            vertices[19] = new VertexPositionColor(new Vector3(-1, 0, 0), Color.Green);
            vertices[20] = new VertexPositionColor(new Vector3(0, 0, 1), Color.Blue);
            vertices[21] = new VertexPositionColor(new Vector3(0, -1, 0), Color.Red);
            vertices[22] = new VertexPositionColor(new Vector3(1, 0, 0), Color.Green);
            vertices[23] = new VertexPositionColor(new Vector3(0, 0, -1), Color.Blue);

            vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 24, BufferUsage.WriteOnly);
            vertexBuffer.SetData<VertexPositionColor>(vertices);
        }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            angle += 0.01f;
            view = Matrix.CreateLookAt(
                new Vector3(5 * (float)Math.Sin(angle), -2, 5 * (float)Math.Cos(angle)),
                new Vector3(0, 0, 0),
                Vector3.UnitY);

            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            basicEffect.World = world;
            basicEffect.View = view;
            basicEffect.Projection = projection;
            basicEffect.VertexColorEnabled = true;

            GraphicsDevice.SetVertexBuffer(vertexBuffer);

            RasterizerState rasterizerState = new RasterizerState();
            rasterizerState.CullMode = CullMode.None;
            GraphicsDevice.RasterizerState = rasterizerState;

            foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 24);
            }

            base.Draw(gameTime);
        }
    }
}

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

Icosahedron

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace DrawingTriangles
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        VertexBuffer vertexBuffer;

        BasicEffect basicEffect;
        Matrix world = Matrix.CreateTranslation(0, 0, 0);
        Matrix view = Matrix.CreateLookAt(new Vector3(0, 0, 3), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 480f, 0.01f, 100f);
        double angle = 0;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            basicEffect = new BasicEffect(GraphicsDevice);

            VertexPositionColor[] vertices = new VertexPositionColor[60];
            vertices[0] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, 0.42532500f), Color.Red);
            vertices[1] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, 0.26286500f), Color.Orange);
            vertices[2] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, 0.42532500f), Color.Green);
            vertices[3] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, 0.42532500f), Color.Yellow);
            vertices[4] = new VertexPositionColor(new Vector3(-0.42532500f, -0.26286500f, 0.0000000f), Color.Red);
            vertices[5] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, 0.26286500f), Color.Orange);
            vertices[6] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, 0.42532500f), Color.Green);
            vertices[7] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, 0.26286500f), Color.Orange);
            vertices[8] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, 0.42532500f), Color.Yellow);
            vertices[9] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, 0.42532500f), Color.Yellow);
            vertices[10] = new VertexPositionColor(new Vector3(0.42532500f, 0.26286500f, 0.0000000f), Color.Red);
            vertices[11] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, 0.26286500f), Color.Orange);
            vertices[12] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, 0.42532500f), Color.Green);
            vertices[13] = new VertexPositionColor(new Vector3(0.42532500f, -0.26286500f, 0.0000000f), Color.Yellow);
            vertices[14] = new VertexPositionColor(new Vector3(0.42532500f, 0.26286500f, 0.0000000f), Color.Blue);
            vertices[15] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, -0.42532500f), Color.Red);
            vertices[16] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, -0.26286500f), Color.Yellow);
            vertices[17] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, -0.42532500f), Color.Blue);
            vertices[18] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, -0.42532500f), Color.Red);
            vertices[19] = new VertexPositionColor(new Vector3(-0.42532500f, 0.26286500f, 0.0000000f), Color.Orange);
            vertices[20] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, -0.26286500f), Color.Green);
            vertices[21] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, -0.42532500f), Color.Red);
            vertices[22] = new VertexPositionColor(new Vector3(-0.42532500f, -0.26286500f, 0.0000000f), Color.Yellow);
            vertices[23] = new VertexPositionColor(new Vector3(-0.42532500f, 0.26286500f, 0.0000000f), Color.Blue);
            vertices[24] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, -0.42532500f), Color.Orange);
            vertices[25] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, -0.26286500f), Color.Yellow);
            vertices[26] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, -0.42532500f), Color.Red);
            vertices[27] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, -0.42532500f), Color.Green);
            vertices[28] = new VertexPositionColor(new Vector3(0.42532500f, -0.26286500f, 0.0000000f), Color.Red);
            vertices[29] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, -0.26286500f), Color.Blue);
            vertices[30] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, 0.26286500f), Color.Red);
            vertices[31] = new VertexPositionColor(new Vector3(0.42532500f, 0.26286500f, 0.0000000f), Color.Green);
            vertices[32] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, -0.26286500f), Color.Yellow);
            vertices[33] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, 0.26286500f), Color.Orange);
            vertices[34] = new VertexPositionColor(new Vector3(-0.42532500f, 0.26286500f, 0.0000000f), Color.Blue);
            vertices[35] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, 0.42532500f), Color.Yellow);
            vertices[36] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, -0.26286500f), Color.Green);
            vertices[37] = new VertexPositionColor(new Vector3(0.42532500f, 0.26286500f, 0.0000000f), Color.Blue);
            vertices[38] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, -0.42532500f), Color.Yellow);
            vertices[39] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, -0.26286500f), Color.White);
            vertices[40] = new VertexPositionColor(new Vector3(-0.42532500f, 0.26286500f, 0.0000000f), Color.Yellow);
            vertices[41] = new VertexPositionColor(new Vector3(0.0000000f, 0.42532500f, 0.26286500f), Color.Red);
            vertices[42] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, 0.26286500f), Color.Green);
            vertices[43] = new VertexPositionColor(new Vector3(0.42532500f, -0.26286500f, 0.0000000f), Color.Red);
            vertices[44] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, 0.42532500f), Color.Orange);
            vertices[45] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, 0.26286500f), Color.White);
            vertices[46] = new VertexPositionColor(new Vector3(-0.42532500f, -0.26286500f, 0.0000000f), Color.Red);
            vertices[47] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, -0.26286500f), Color.Green);
            vertices[48] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, -0.26286500f), Color.Yellow);
            vertices[49] = new VertexPositionColor(new Vector3(0.42532500f, -0.26286500f, 0.0000000f), Color.Blue);
            vertices[50] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, 0.26286500f), Color.Red);
            vertices[51] = new VertexPositionColor(new Vector3(0.0000000f, -0.42532500f, -0.26286500f), Color.White);
            vertices[52] = new VertexPositionColor(new Vector3(-0.42532500f, -0.26286500f, 0.0000000f), Color.Red);
            vertices[53] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, -0.42532500f), Color.Yellow);
            vertices[54] = new VertexPositionColor(new Vector3(0.42532500f, 0.26286500f, 0.0000000f), Color.Green);
            vertices[55] = new VertexPositionColor(new Vector3(0.42532500f, -0.26286500f, 0.0000000f), Color.White);
            vertices[56] = new VertexPositionColor(new Vector3(0.26286500f, 0.0000000f, -0.42532500f), Color.Red);
            vertices[57] = new VertexPositionColor(new Vector3(-0.42532500f, 0.26286500f, 0.0000000f), Color.Blue);
            vertices[58] = new VertexPositionColor(new Vector3(-0.42532500f, -0.26286500f, 0.0000000f), Color.White);
            vertices[59] = new VertexPositionColor(new Vector3(-0.26286500f, 0.0000000f, 0.42532500f), Color.Green);

            vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 60, BufferUsage.WriteOnly);
            vertexBuffer.SetData<VertexPositionColor>(vertices);
        }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            angle += 0.01f;
            view = Matrix.CreateLookAt(
                new Vector3(5 * (float)Math.Sin(angle), -2, 5 * (float)Math.Cos(angle)),
                new Vector3(0, 0, 0),
                Vector3.UnitY);

            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            basicEffect.World = world;
            basicEffect.View = view;
            basicEffect.Projection = projection;
            basicEffect.VertexColorEnabled = true;

            GraphicsDevice.SetVertexBuffer(vertexBuffer);

            RasterizerState rasterizerState = new RasterizerState();
            rasterizerState.CullMode = CullMode.None;
            GraphicsDevice.RasterizerState = rasterizerState;

            foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 20);
            }

            base.Draw(gameTime);
        }
    }
}