GDI vs Direct2D

Sep 28, 2012 at 8:50am
I heard Direct2D is better(as in graphics) than GDI cause it was introduced in Win 7. But which one is easier to learn? or which one should I learn first?
Sep 28, 2012 at 10:42am
In general, I've found that configuration of Direct3D and its descendants is a chore due to the verbosity of the APIs. While I don't have much experience with GDI, I'm fairly sure that it just acts as an extension of WinAPI and would be much easier to configure. However, at the same time I'm fairly sure that GDI only allows for software rendering, which would cause a nice performance hit for more intense 2D applications.
Sep 28, 2012 at 11:54am
Well, GDI is the starting point. So I would learn at least the basics of that before moving on to look at Direct2D, etc.

As Direct2D
http://msdn.microsoft.com/en-us/library/windows/desktop/dd370990%28v=vs.85%29.aspx
says...

The Direct2D API is designed to interoperate well with GDI, GDI+, and Direct3D.

So it sound like you'd typically use GDI for the basic stuff (as it's easier/more cost effective) and Direct2D when you need the power

I've mostly used GDI, which I see as just a regular part of the core Win32 API [1] (well, it's part of Petzold's Programming Windows book [2]). I've also used GDI+, which is pretty easier to pick up once you know GDI. And some DirectX (inc. Direct3D) which is rather more involved!

Andy

[1] The core of the Win32 API is provided kernel32.dll (base services), user32.dll (UI services), and gdi32.dll (graphics services). I'd also add advapi32.dll (advanced services) as it provides registry access, etc. And then you have the shell, the common controls and dialogs, network services, etc, etc, etc.
[2] Programming Windows®, Fifth Edition
Table of Contents
http://www.microsoft.com/mspress/books/toc/2344.aspx
Last edited on Sep 28, 2012 at 12:15pm
Sep 28, 2012 at 12:24pm
closed account (z05DSL3A)
A few articles from MSDN on Direct2D:

Introducing Direct2D
http://msdn.microsoft.com/en-us/magazine/dd861344.aspx

Drawing with Direct2D
http://msdn.microsoft.com/en-us/magazine/ee413543.aspx

Layered Windows with Direct2D
http://msdn.microsoft.com/en-us/magazine/ee819134.aspx

If you are not bothered about older code, I would start with Direct2D.
Sep 29, 2012 at 9:27am
Thanks!
Sep 29, 2012 at 11:19pm
closed account (S6k9GNh0)
Why not look into OpenGL or a software rendering library like SDL or SFML (which might or might no sit on an API like OpenGL/Direct2D).
Sep 30, 2012 at 1:02pm
SFML wraps around OpenGL and provides hardware acceleration, not just software, I think SDL 2.0 also provides hardware acceleration now.
Sep 30, 2012 at 5:59pm
Is SDL 2 out? The site is still pitching ver 1.2. I haven't seen an update in like 10 years.
Sep 30, 2012 at 8:40pm
closed account (S6k9GNh0)
Disch, SDL 2 isn't officially out. The wiki has been defaulted to SDL 2 though for nearly 3 years now. It's ridiculous. Their was a recent push to get SDL 2 out the door (thanks to Ryan Gordon) because of development on the Humble Indie Bundle games. Unfortunately, it's *still* not out and developers in IRC say the same thing they've said for years, "It'll be out when its ready". I've pretty much given up hope to be honest.

Sep 30, 2012 at 9:16pm
Ok thanks to you all. Right now I'm looking at GDI, then I'll move on to OpenGL or SFML. Any comments on which one I should learn next?

Thanks in advance...
Oct 1, 2012 at 6:18am
closed account (S6k9GNh0)
SFML sits on top of OpenGL. OpenGL is rather complicated... As a result, I would suggest SFML/SDL2.
Oct 2, 2012 at 8:05am
Yeah just glanced through SFML2.0 tut and it's great. Really good!!!
Thank you!
Topic archived. No new replies allowed.