gnom Posted December 23, 2005 Posted December 23, 2005 Hello, since I'm making my first steps in DirectX I have a very simple question - what is wrong with that 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 Quote
gnom Posted December 26, 2005 Author Posted December 26, 2005 :p Since nobody answered I understand that I managed to RenderPrimitives thanks to your prayers. So here is the code:RenderPrimitives.zip Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.