0

I am currently developing a software that involves real-time rendering of performance metrics in graph and chart forms. I need to acquire data, process data and render an image as fast as possible. My backend is in C++, and I am at a point where I have to make a choice regarding the front end. Given my backend is in C++, I was inclined to go with MFC. The other alternative is to go with WPF C# for frontend and interop with my C++ backend. I read recently that WPF provides for hardware acceleration, this should help me achieve a high frame rate. Does MFC hardware accelerate its graphics too? Does hardware acceleration even matter? Given WPF's hardware acceleration, does that make WPF the most efficient alternative for graphics in my case?

user2654449
  • 119
  • 7
  • Any particular reason why you souldn't use OpenGL / DirectX for gpu- accelerated rasterization? – gifnoc-gkp Jun 01 '14 at 22:12
  • If I use WPF, does it not internalize OpenGL/DirectX based rendering? With MFC, I will need to do it on my own. I do not know how, or how difficult that is going to be. – user2654449 Jun 01 '14 at 22:18
  • I suggest to go for XNA. it provides managed runtime environment that facilitates video game development. http://en.wikipedia.org/wiki/Microsoft_XNA – pushpraj Jun 02 '14 at 01:50

2 Answers2

1

WPF provides hardware acceleration using DirectX 9 I believe. However for line graphs the limiting factor is the amount of interface elements. We are creating a program in WPF that displays sEMG data real-time using Telerik charts. These can be configured to use direct2d acceleration under the hood which cranks up the performance a bit if you have a lot of datapoints. It's still jerky though because you cannot control the render thread of WPF.

It kind of depends on the amount of features you need in the graph. If the priority is to have silky smooth real-time display don't go with WPF.

Wouter
  • 2,170
  • 1
  • 28
  • 58
0

Visual Studio 2010 added classes to MFC to support using Direct2D rendering from MFC programs.

To use Direct2D, you start by calling EnableD2DSupport() in your View's OnCreate (technically, I suppose it doesn't have to be in OnCreate, but that's the usual place). Then you'll receive AFX_WM_DRAW2D messages when the D2D display context needs updating, so you'll normally want to add a handler for that, and respond to it by rendering your content as needed.

Another possibility to consider would be to use an existing control to draw your graphs. There are quite a few around, including some that are free with quite liberal licensing. Just for example, CodeProject has a number of Charting controls, a few of which use D2D for their drawing, and quite a few more that don't.

Honestly, I'd be a little surprised at charts having information being updated fast enough for drawing speed to make a huge difference as a rule though. In most typical cases, the real limit will be the user's ability to comprehend what you're drawing. A user simply can't watch 100 different graphs each being updated at (say) 60 Hz, and have much hope of deriving much real meaning from most of them. In most cases, the real challenge isn't to draw more data faster, but to provide better ways for the user to focus on the few things they can follow at a time, and (for example) draw their attention to important changes when needed.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111