So, let's draw a cube using our new 3D knowledge. First, we change the number of vertices to 36 since we must use a TriangleList to make a cube.
 ``` VertexCount = 36 VxB = New VertexBuffer(GetType(CustomVertex.PositionColored), VertexCount, D9, Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Managed) 'That is a LOT of non-trivial parameters.```
Getting the vertices of the cube to go in the right order are tricky:
 ``` Private Sub SetVertexBufferData(ByRef vs As CustomVertex.PositionColored(), ByVal vxbf As VertexBuffer, ByVal D9 As Device) 'After that workout, we now have to actually set the vertices. 'We do this by locking the surface out of D9 while we "operate" on it. Dim A As Array = vxbf.Lock(0, LockFlags.None) 'It returns a vanilla array... vs = DirectCast(A, CustomVertex.PositionColored()) 'So we have to convert it to an array of TransformedColored vertices. 'Remember: TransformColored vertices come with X, Y, Z, and Regularly Holding Wone, along with color. 'PositionColored has no RHW: only X, Y, Z (position) and Color. 'z = 0, 0,0,0 vs(0) = New CustomVertex.PositionColored(0.0F, 0.0F, 0.0F, &H505050) vs(1) = New CustomVertex.PositionColored(2.0F, 0.0F, 0.0F, &HF05050) vs(2) = New CustomVertex.PositionColored(0.0F, 2.0F, 0.0F, &H50F050) 'z = 0, 2,2,0 vs(3) = New CustomVertex.PositionColored(2.0F, 2.0F, 0.0F, &H5050F0) vs(4) = New CustomVertex.PositionColored(0.0F, 2.0F, 0.0F, &H50F050) vs(5) = New CustomVertex.PositionColored(2.0F, 0.0F, 0.0F, &HF05050) 'x = 0, 0,0,0 vs(6) = New CustomVertex.PositionColored(0.0F, 0.0F, 0.0F, &H505050) vs(7) = New CustomVertex.PositionColored(0.0F, 2.0F, 0.0F, &H50F050) '* vs(8) = New CustomVertex.PositionColored(0.0F, 0.0F, 2.0F, &H5050F0) '* 'x = 0, 0,2,2 vs(9) = New CustomVertex.PositionColored(0.0F, 2.0F, 2.0F, &HF05050) vs(10) = New CustomVertex.PositionColored(0.0F, 0.0F, 2.0F, &H5050F0) vs(11) = New CustomVertex.PositionColored(0.0F, 2.0F, 0.0F, &H50F050) 'y = 0, 0,0,0 vs(12) = New CustomVertex.PositionColored(0.0F, 0.0F, 0.0F, &H505050) vs(13) = New CustomVertex.PositionColored(0.0F, 0.0F, 2.0F, &H5050F0) vs(14) = New CustomVertex.PositionColored(2.0F, 0.0F, 0.0F, &HF05050) 'y = 0, 2,0,2 vs(15) = New CustomVertex.PositionColored(2.0F, 0.0F, 2.0F, &H50F050) vs(16) = New CustomVertex.PositionColored(2.0F, 0.0F, 0.0F, &HF05050) vs(17) = New CustomVertex.PositionColored(0.0F, 0.0F, 2.0F, &H5050F0) 'z = 2, 0,0,2 vs(18) = New CustomVertex.PositionColored(0.0F, 0.0F, 2.0F, &H5050F0) vs(19) = New CustomVertex.PositionColored(0.0F, 2.0F, 2.0F, &HF05050) vs(20) = New CustomVertex.PositionColored(2.0F, 0.0F, 2.0F, &H50F050) 'z = 2, 2,2,2 vs(21) = New CustomVertex.PositionColored(2.0F, 2.0F, 2.0F, &H505050) vs(22) = New CustomVertex.PositionColored(2.0F, 0.0F, 2.0F, &H50F050) vs(23) = New CustomVertex.PositionColored(0.0F, 2.0F, 2.0F, &HF05050) 'y = 2, 0,2,0 vs(24) = New CustomVertex.PositionColored(0.0F, 2.0F, 0.0F, &H50F050) vs(25) = New CustomVertex.PositionColored(2.0F, 2.0F, 0.0F, &H5050F0) vs(26) = New CustomVertex.PositionColored(0.0F, 2.0F, 2.0F, &HF05050) 'y = 2, 2,2,2 vs(27) = New CustomVertex.PositionColored(2.0F, 2.0F, 2.0F, &H505050) vs(28) = New CustomVertex.PositionColored(0.0F, 2.0F, 2.0F, &HF05050) vs(29) = New CustomVertex.PositionColored(2.0F, 2.0F, 0.0F, &H5050F0) 'x = 2, 2,0,0 vs(30) = New CustomVertex.PositionColored(2.0F, 0.0F, 0.0F, &HF05050) vs(31) = New CustomVertex.PositionColored(2.0F, 0.0F, 2.0F, &H50F050) vs(32) = New CustomVertex.PositionColored(2.0F, 2.0F, 0.0F, &H5050F0) 'x = 2, 2,2,2 vs(33) = New CustomVertex.PositionColored(2.0F, 2.0F, 2.0F, &H505050) vs(34) = New CustomVertex.PositionColored(2.0F, 2.0F, 0.0F, &H5050F0) vs(35) = New CustomVertex.PositionColored(2.0F, 0.0F, 2.0F, &H50F050) 'It's important to unlock the vertex buffer, so that D9 can see what we put in there. vxbf.Unlock() End Sub```
But, proper setup allows you cull the invisible sides:
 ``` D9.RenderState.CullMode = Cull.CounterClockwise D9.RenderState.Lighting = False```
And we also need to be looking at the cube.
 ``` Camera = New Vector3(3.0F, 3.0F, 3.0F) FocusPt = New Vector3(1.0F, 1.0F, 1.0F) CamNormal = New Vector3(0.0F, 0.0F, 1.0F)```
Don't forget that we're using a TriangleList:
 ` Dim PrT As PrimitiveType = PrimitiveType.TriangleList`

Now, we'll add the capabilities to move around in space - here's something I threw together - it's challenging to navigate.
 ``` If e.KeyCode = Keys.Escape Then Running = False 'End the game loop when Escape is pressed. ElseIf e.KeyCode = Keys.Pause Then Paused = Not Paused End If If Not Paused Then Select Case e.KeyCode Case Keys.NumPad2 Camera.Y -= 1 Case Keys.NumPad4 Camera.X -= 1 Case Keys.NumPad6 Camera.X += 1 Case Keys.NumPad8 Camera.Y += 1 Case Keys.Divide Camera.Z += 1 Case Keys.NumPad5 Camera.Z -= 1 End Select End If```
This will allow you to explore the cube's full 3D nature.
.vb file