Skip to main content
GameDev.net gamedev.net
🔒 Locked

Using DirectX to plot 3d graph data

Started by urizn Jul 24, 2005 at 9:10 PM 1 replies 6k views
Original Post
urizn
urizn
Hi. I'm beginning Direct X and I'm trying to make a surface plot of some (x,y,z) data like Matlab. I'm pretty sure ( read as hope to god) this is possible. If anyone could point me in the directions of the some methods to use I would be eternally grateful.
Armadon
Armadon
Hi there Urizn,
DirectX and plotting graphs it should be a fairly easy excercise.

1) Create the window : C#: your class inherits from Form. (Remember to include the reference to System and System.Windows.Forms) Window window = new Window(...);

2) Create the device : C#: Device device = new Device(...); (Include a reference to Microsoft.DirectX, Microsoft.DirectX.Direct3D)

3) Create an array of vertices that you would like to render : C#: CustomVertex.PositionColored[] points = new CustomVertex.PositionColored[5];
points[0] = new CustomVertex.PositionColored(1.0f, 0.0f, 0.0f, Color.White); (Remember to include a reference to System.Drawing);

4) Create the VertexBuffer : C#: VertexBuffer vertexBuffer = new VertexBuffer(...);

5) Set the Vertex Format : C#: device.VertexFormat = CustomVertex.PositionColored.Format;

6) Set the stream source(Vertex buffer) : C#: device.SetStreamSource(0, vertexBuffer, 0);

7) Render the points : C#: device.DrawPrimitives(PrimitiveType.PointList, 0, 5)

I hope this pulls you into the right direction.
urizn
urizn
Sorry I took so long to reply, but dude you're awesome and your site it is much help. thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.