- 82 名前:動け動けウゴウゴ2ちゃんねる mailto:sage [2011/11/08(火) 00:01:13.61 ]
- 超初心者なんですが、Managedで勉強少ししたんですが、
C++で勉強した方が後々良いのでしょうか。 ちなみに、C#で正四面体を表示しようと sorceryforce.com/manageddirectx/direct3d_box.html 上記のページを参考にコードを書いたのですがうまくいきません スレ違いはわかってますが、できれば教えていただきたいです。 private byte[] vertexIndices = new byte[] { 0,1,3, 3,2,1, 1,0,3, 3,2,0 }; vertex = new VertexBuffer(typeof(CustomVertex.PositionColored), 4, device, Usage.None, CustomVertex.PositionColored.Format, Pool.Managed); using (GraphicsStream data = vertex.Lock(0, 0, LockFlags.None)) { CustomVertex.PositionColored[] vertices = new CustomVertex.PositionColored[4]; vertices[0] = new CustomVertex.PositionColored(1f, 1f, 1f, Color.Red.ToArgb()); vertices[1] = new CustomVertex.PositionColored(1f, -1f, -1f, Color.Green.ToArgb()); vertices[2] = new CustomVertex.PositionColored(-1f, 1f, -1f, Color.Blue.ToArgb()); vertices[3] = new CustomVertex.PositionColored(-1f, -1f, 1f, Color.Yellow.ToArgb()); data.Write(vertices); vertex.Unlock(); } indexBuffer = new IndexBuffer(device, 4 * 3 * 1, Usage.WriteOnly, Pool.Managed, true); using (GraphicsStream data = indexBuffer.Lock(0, 0, LockFlags.None)) { data.Write(vertexIndices); indexBuffer.Unlock(); }
|

|