Re: c# and GDI graphics



Daniel,

It is possible, but the one main advantage that the DirectX solution has
over the GDI app is that DirectX is going to utilize hardware acceleration
when it can, whereas GDI won't (you are simply pushing pixels to the screen
there, very low level).

If your requirements and your development permit (XP/2003 and above,
don't mind using the .NET 3.0 framework which is not even in beta yet), you
might want to try using the Windows Presentation Foundation. It will give
you the benefits of hardware acceleration (it utilizes DX underneath the
covers) and an easy programming model.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"Daniel" <DanielV@xxxxxxxxxxxxxxxx> wrote in message
news:%23DggsKL2GHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
Hi

I had an app i write on DirectX that will nearly always run in a windowed
situation. It could also have many instances running at a time and as such
to keep the cpu usage down i had a frame refresh sticker ever 32 ms rather
than maximum speed. This worked great but then i thought as all my
graphics are 2D this is huge over kill.

So i decided to port it to GDI graphics. At first a good idea i could
easily do everything i was using with Directx but less end requirements
for the user and much smaller code and less 'set up' code.

However first i found severe flicker with the GDI solution. So i
implemented a double buffer which solved the flicker but all my
transparent imagery was lost (due to the doubling up). I found if i clear
the back buffer to prevent doubling up i get a flicker again.

this all aside a even bigger problem, my cpu usage is FAR worse than it
was with directx. With a refresh every second it still spikes to 18% for
one instance. I have seen rival products on the market use simple graphics
who keep the cpu under 5% when i had 10 instances open.

What am i doing wrong? Is it possible to make an efficient GDI app?





.



Relevant Pages

  • Re: GDI+ performace in Drawing Applications
    ... but what exactly is "Hardware acceleration" and how ... If you draw a GDI rectangle or a line, ... DirectX isn't really a drawing API the way GDI+. ... applying sets of polygons in a three dimensional space whereas GDI+ ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Should I try to port from DirectX 9.0c to GDI+
    ... The only speed requirement I have is that the user can 'grab' the 3D view ... GDI and GDI+ don't handle those things directly. ... Systems like DirectX and OpenGL have convenient access ... If you can generate an RGBQUAD array the size of your draw region at ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: GDI can be fast!
    ... manipulate. ... the new bitmap with the BltBit function. ... The advantage of writing to memory directly comes from the potential that exists for doing things, not possible to do with GDI, and doing things _easier_ then GDI. ... This means ability to play with functionality that would require a lot more code and forethought with GDI, and even DirectX provide. ...
    (alt.lang.asm)
  • Re: DirectX vs GDI
    ... If you want to learn about writing games, collisions, path finding and other ... It covers both GDI and Managed ... DirectX so you can compare and contrast and it walks through basic game dev ... > 7.0 so you don't need a separate SDK. ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: OnPaint Function Issue
    ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... > Answer those GDI+ questions with the GDI+ FAQ ... > GDI doesn't have a concept of double buffering. ... For the fastest possible speed make calls to the DirectX API's from the ...
    (microsoft.public.dotnet.framework.drawing)