Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...