Look for a faster than GDI dynamic data rendering solution

I wrote a simple GDI-based data plotter using C ++ / CLI, but this is not particularly fast (some basic profiling indicates that rendering reflects this problem).

Is there a way to enable hardware acceleration for UserControl or is there a .net interface for direct3D? ... or are there some other options that I might consider.

We use managed code, so the solution really should be compatible with the CLI, if at all possible.

[Edit] In case this helps, I smooth out the stripes (128 data points) of the rectangles, each of which has 2x2 pixels, using Graphics::FillRectangle - maybe the best way to do this?

+2
source share
4 answers

Managed DirectX has been deprecated for some time. You really do not want to use this. Instead, you should use SlimDX , which is the open source interface layer for the DirectX SDK APIs written in C ++ / CLI. This is better than Managed DirectX and is supported by an expert community of developers. (I will be working on improving DirectWrite support soon).

+5
source

From my experience, you will not get good enough performance from using GDI +. Even for simple drawing, you will quickly realize that there is a lot of overhead.

Alternatives would be (as you mentioned) Direct3D, or you could consider regular GDIs with system calls. This clearly makes the code platform freeze, but it can be pretty fast. I have had good results using this.

It all depends on the complexity with which you are ready to cope. GDI can be relatively lightweight, once you figure out the basics, Direct3D is a bit more complicated. Although Direct3D is a more reliable future.

+2
source

It is true that GDI + is not very good in performance, but I myself wrote a GDI + plotter in a work-related project that is able to spit out graphs with thousands of dots at ~ 30 frames per second at a resolution of 1680x1050 (scroll graph).

It took a lot of settings:

  • Convert everything in one way before drawing.
  • If you use back-buffer, use one with the pixel format Format32bppPArgb, this can speed up blitting 2-4x.
  • If you draw a path using a lot of vertical lines (high frequency signal), instead draw them as horizontal lines on the back buffer, and then draw an image rotated on the screen. Keep in mind that when you rotate the image there is also a certain cost.

I don’t see how your script requires a lot of optimization, although 128 data points are nothing. Including these points in a single GraphicsPath could make a difference, since that would mean less sorting workload.

What resolution and frame rate are we talking about here, by the way?

+2
source

Microsoft now also has Direct2D , which is a hardware accelerated 2D drawing:

Direct2D is a hardware acceleration, an immediate, two-dimensional graphics API that provides high performance and high-quality rendering for 2-D geometry, bitmaps and text. The Direct2D API is designed to interact well with GDI, GDI + and Direct3D.

Windows 7 / Server 2008 R2 is required, but support was added in Vista / Server 2008 using the Platform Update :

+1
source

All Articles