   MDX 2 - DrawUserPrimitives()
  Hello,I'm trying to draw some line with DrawUserPrimitives() in MD3D 2.As I understand I need a GraphicsBuffer for that. But I can't figure out how to fill it with my data.I'm also wondering how I can tell the device about my vertexformat.Some advice would be nice, since some things seem to have changed in MDX 2 and the sdk samples use a earlier version.   
  You should use the generic version of a graphics buffer. This will allows you to use the write methods to add your vertexes.You need to set your vertex format with the VertexFormat or VertexDeclaration property before you call any draw method. PS: You should not use MDX 2 for a real project as it will never released in it’s current form. Better stay with MDX1 and wait for the XNA framework.;  I did not know that MDX 2 will go away. What purpose does it serve then?   ;  You should read this blog entry from Tom Miller.   ;  Thanks, that was an interesting read.I am trying to draw a line like this:   Vertex_Colored[] vertices = new Vertex_Colored[2];   vertices[0] = new Vertex_Colored();   vertices[0].pos = new Vector3(0, 0, -5);   vertices[0].color = Color.White.ToArgb();   vertices[1] = new Vertex_Colored();   vertices[1].pos = new Vector3(0, 0, 5);   vertices[1].color = Color.White.ToArgb();   GraphicsBuffer<Vertex_Colored> gb = new GraphicsBuffer<Vertex_Colored>(2);   gb.Write(vertices);rdevice.device.VertexFormat = VertexFormats.Position | VertexFormats.Diffuse;   rdevice.device.DrawUserPrimitives(PrimitiveType.LineList, 1, gb);   gb.Dispose();I can see a line. But it is black rather than white.I did call this beforehand: device.SetTextureState(0, TextureStates.ColorOperation, false);[Edited by - B_old on May 19, 2006 9:16:28 AM];  I am really surprised that you are using a structure called Vertex_Colored. It seems like a user-defined structure. I don't think DirectX will be able to recognize it.Since you are using MDX2, you can just use the build-in structure PositionColored and the code should be like this:    PositionColored[] vertices = new PositionColored[2];    vertices[0].Position = new Vector3(0, 0, -5);    vertices[0].Color = Color.White;    vertices[1].Position = new Vector3(0, 0, 5);    vertices[1].Color = Color.White;    GraphicsBuffer<PositionColored> gb = new GraphicsBuffer<PositionColored>(2);    gb.Write(vertices);    rdevice.device.VertexFormat = PositionColored.Format;    rdevice.device.DrawUserPrimitives(PrimitiveType.LineList, 1, gb);    gb.Dispose();Don't forget to declareusing Microsoft.DirectX.Direct3D.CustomVertex;