0
votes

I have an MFC application to draw graph using DirectX. Now I have to add the feature to draw the area graph in DirectX.

Now my application draws like this..

enter image description here

I want to include the feature to my graph to look like this..

enter image description here

here I have to fill the graph area with some color.

I have tried DrawPrimitive(). but this could be used to draw the Triangle, rectangle. but in my application I would like to draw graph with random data points.

Is it possible to achieve in DirectX..?

Kindly someone provide your suggestions.

1
If you only need 2D drawing, Direct2D is much easier to work with than the full API.Roger Rowland
Thank you Roger. I need in 2D only. I will read about direct2D and check.San
You can fill the area using polygon triangulation. Refer geometrictools.com/Documentation/TriangulationByEarClipping.pdf .There are so many pre-written examples and papers. eg: codeproject.com/Articles/319399/Terrain-Rendering and codeproject.com/Articles/492435/… . 2d specific triangulation code.google.com/p/poly2tri...Dharani Kumar
If you look at path geometries first, you may find it an easy way to fill the shape by defining the border path and filling that rather than drawing lots of individual lines.Roger Rowland
@Roger and Dharani: for using path geometrics or Direct2D, I should have Windows SDk v7.0 or v7.1 it seems. I have SDK v6.0 only. So I'm getting d2d1.h missing error. Is it possible to use Direct2D with SDK v6.0?San

1 Answers

0
votes

If u need 2d graph's alone Direct2D is a great option,But if you insist on going to 3D for greater animation and illustrative purposes you can uses OpenGL.There are plenty of custom controls for graph illustration purposes based on OpenGL.

For eg: http://www.codeproject.com/Articles/4346/D-Graph-ActiveX-Control

Opengl has greater flexibility and can serve your needs better since it is of open source.

hope this helps and Good Luck