tags:

views:

65

answers:

2

Hello everyone,

I have taken a recent interest in programming as efficiently as possible for Windows in straight C. I still want a GUI for some things, is the Windows API/GDI still the respectable way to go about this? I don't believe you can make regular calls for WPF, since it is largely a managed affair. Is GDI really un-accelerated under Vista/Win7? If so, is there another alternative to get hardware accelerated GUIs from straight C? (Other than perhaps the roll-yer-own approach with OpenGL)

Also, Petzold used to be the gold standard for picking up Windows API programming with C, is there a newer edition of his materials, or has someone else taken up the mantle? The last edition I saw is from 1999...

A: 

DirectX is in general much faster than GDI, due to the fact that it has full acceleration on most video cards. GDI may have some acceleration (on Windows 7 and XP, but not Vista), but DirectX is still the way to go.

Book wise, Petzold is all about WPF these days: Programming Windows Three Dimensional Presentation Foundation

Michael Goldshteyn
+1  A: 

Microsoft has a page comparing GDI vs Direct2D hardware acceleration.

GDI always has been an accelerated API: of course, it was always left up to the actual GDI driver implementation to decide which bits of the GDI DDI to actually accelerate so its usually been the bitblt / stretch blit operations that have been accelerated, and all the line drawing and other effects are done by CPU.

some people take this as a sign that GDI is no longer "good enough" compared to newer APIs but frankly all graphics really revolves down to moving rects around.

GdiPlus is implemented in software, and so, as a result, is the system.graphics CLR implementation.

Chris Becke
Accepted on the basis that this response is the closest to a direct answer of my questions. Bonus points for linking to an appropriate MSDN page.
Chris D.