2D in DirectX 9

Started by
6 comments, last by GameDev.net 19 years, 5 months ago
Does anyone know any tutorials about making 2D-games with Direct3D/DX9? All I can find is tutorials on DirectDraw/DX8..
Advertisement
My guess is that it's probably like doing 2D in OpenGL (sorry I don't use Direct3D, so I hope I can help).

Look up how to set a 2D projection mode (also called "orthogonal" mode).

Then it's simply a matter of using normal 3D stuff, but just making all the Z axies 0 (unless you want to use the depth buffer).
In Direct3D there are twoways of doing 2D in (D)3D. (Of course there are more, but these are more commonly used).

1) Use textured quads. Using transformed vertices (the ones with X, Y, Z and RHW) to make 2 screen-space triangles, and texture those to form a textured quad. (All this using X and Y as screenpixels)

2) Simply use the ID3DXSprite interface, which handles all of option 1, but also adds more functionality and simplicity. Just look for tutorials on it (the SDK documentation is a good start, the DirectX Forum FAQ (on this board) too). Here's a direct link to DX9 tutorials.

I'd recommend using option 2, because it's more user-friendly, and it allows you to develope faster. In case you're wondering whether to use option 1 or not, don't! Just don't. Instead of learning more, you'll actually be wasting time. At some point when you go into real 3D, you'll understand option 1 and you'll be glad you picked the other/better way.
why do you want to make a 2d game with D3d?DirectDraw will give you everything you ever gonna need in 2D.
http://www.gametutorials.com

It has some game tutorials with DirectShow and opengl, Have you known it before?
From what I have gathered Microsoft are trying to phase out DirectDraw and have totally redesigned the 2D features of Direct3D in DirectX 9 to provide an alternative. Direct3D will provides a simpler way to do 2D the only real problem is a lack of tutorials for it.
Thanks people.. I'll check out ID3DXSprite (and ignore the other option)!

and jimywang: I'm using D3D because DirectDraw doesn't exist as of DirectX9..
It does still exist, it's just depreticated, and nowdays you get better preformance using a 3D API than a 2D API, hardware standards aim more towards 3D Acceleration.

Decsonic

This topic is closed to new replies.

Advertisement