Drawing a simple rectangle
Here's my code:
Declarations:
Protected vb As VertexBuffer, ib As IndexBuffer
Protected vertexData As VertexPositionColor(), indexData As Integer()
DeviceCreated event:
vb = New VertexBuffer( _
graphics.GraphicsDevice, _
GetType(VertexPositionColor), _
4, _
ResourceUsage.WriteOnly, _
ResourcePool.Managed)
ib = New IndexBuffer( _
graphics.GraphicsDevice, _
GetType(Integer), _
6, _
ResourceUsage.WriteOnly, _
ResourcePool.Managed)
vertexData = New VertexPositionColor(3) {}
vertexData(0) = New VertexPositionColor(New Vector3(0, 0, 0), Color.White)
vertexData(1) = New VertexPositionColor(New Vector3(100, 0, 0), Color.White)
vertexData(2) = New VertexPositionColor(New Vector3(0, 100, 0), Color.White)
vertexData(3) = New VertexPositionColor(New Vector3(100, 100, 0), Color.White)
indexData = New Integer(5) {}
indexData(0) = 0
indexData(1) = 1
indexData(2) = 2
indexData(3) = 1
indexData(4) = 2
indexData(5) = 3
vb.SetData(Of VertexPositionColor)(vertexData, 0, vertexData.Length, SetDataOptions.None)
ib.SetData(Of Integer)(indexData, 0, indexData.Length, SetDataOptions.None)
Drawing/Rendering: Using vertexDecl As New VertexDeclaration(graphicsDevice, VertexPositionColor.VertexElements)
graphicsDevice.Indices = ib
graphicsDevice.Vertices(0).SetSource(vb, 0, VertexPositionColor.SizeInBytes)
graphicsDevice.VertexDeclaration = vertexDecl
graphicsDevice.DrawIndexedPrimitives( _
PrimitiveType.TriangleList, _
0, 0, vertexData.Length, 0, _
indexData.Length / 3)
End Using
It seems to me that this is a simple problem, but there are no simple tutorials for this yet. I would appreciate very much if someone could take a look at tell me, or at least suggest what's wrong. :) Thanks in advance...

