Jump to content
  • Advertisement
Sign in to follow this  
urizn

Using DirectX to plot 3d graph data

This topic is 4853 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sorry I took so long to reply, but dude you're awesome and your site it is much help. thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!