RenderPrimitive in VB.NET

gnom

Newcomer
Joined
Dec 23, 2005
Messages
2
Hello,
since I'm making my first steps in DirectX I have a very simple question - what is wrong with that code:
Code:
            Dim stm As GraphicsStream = vb.Lock(0, 0, 0)
            Dim verts(3) As CustomVertex.TransformedColored
            verts(0).X = 150
            verts(0).Y = 50
            verts(0).Z = 0.5F
            verts(0).Rhw = 1
            verts(0).Color = System.Drawing.Color.Aqua.ToArgb()
            verts(1).X = 250
            verts(1).Y = 250
            verts(1).Z = 0.5F
            verts(1).Rhw = 1
            verts(1).Color = System.Drawing.Color.Brown.ToArgb()
            verts(2).X = 50
            verts(2).Y = 250
            verts(2).Z = 0.5F
            verts(2).Rhw = 1
            verts(2).Color = System.Drawing.Color.LightPink.ToArgb()

            stm.Write(verts)
            
            vb.Unlock()
            D3Ddev.Clear(ClearFlags.Target, System.Drawing.Color.Black, 1.0F, 0)
            D3Ddev.BeginScene()
            D3Ddev.SetStreamSource(0, vertexBuffer, 0)
            D3Ddev.VertexFormat = CustomVertex.TransformedColored.Format
            D3Ddev.DrawPrimitives(PrimitiveType.TriangleList, 0, 1)
            D3Ddev.EndScene()
            D3Ddev.Present()
Can anyone explain my why I get "An unhandled exception of type 'System.InvalidOperationException' occurred in microsoft.directx.dll" after stm.Write(verts)
I know how to use meshes - please don't write "Why don't you use a mesh" :p
 
Back
Top