Sign in to follow this  
arithma

2D in DirectX (8.0, 9.0)

Recommended Posts

arithma    226
I cannot find anything about 2d graphics in the directx sdk help files. Must I used the interfaces of DirectX 7? If not where are these capabilities gone to?

Share this post


Link to post
Share on other sites
lizun    122
for a newbie like me it's quite hard to understand DirectX SDK...
tried looking in google but hadn't found anything about 2D - Sprite using in games...

Share this post


Link to post
Share on other sites
arithma    226
I saw the links and they are great for sprites (skimmed them)
However am searching for how to draw lines, rectangles and basic stuff like these.
Isn't this what DirectDraw was responsible for...

In other words am search for DirectDraw in DirectX 9
(Because I bought Tricks of The Windows Game Programming Gurus from amazon). It seems it depends on the DirectDraw7 interfaces which DirectX 9 lacks

Share this post


Link to post
Share on other sites
evaclear    166
Quote:
Original post by arithma
I saw the links and they are great for sprites (skimmed them)
However am searching for how to draw lines, rectangles and basic stuff like these.
Isn't this what DirectDraw was responsible for...

In other words am search for DirectDraw in DirectX 9
(Because I bought Tricks of The Windows Game Programming Gurus from amazon). It seems it depends on the DirectDraw7 interfaces which DirectX 9 lacks


DirectDraw no longer exists in versions of DirectX starting in 8.0 and up. However DirectX 9 is fully backwards compatible with previous versions of directX. What this means is that it is possible to use the directdraw7 interfaces almost exactly as the book describes. The only thing you should do besides what the book shows is define the directX version your using so that your application knows you want to use the directx version 7 interfaces rather than the 9.0 interfaces. (and include the correct headers/lib files as well)

That said, if you want to proceed with making direct3d applications the "basics" aren't the same as what lamothe has shown. "Basics" in direct3d or openGL for that matter consist of getting setting up the 3d end of things, creating a quad (2 triangles) and rendering a texture to them. Then transforming that quad around in world coordinates. Applying lighting/shading to these quads, and finally animating them. Drawing lines would be considered an "advanced topic" (http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/programmingguide/AdvancedTopics/LineDrawing.asp)

If you want to get the basics of direct3d down I suggest doing the 6 tutorials in the SDK: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/programmingguide/tutorialsandsamplesandtoolsandtips/tutorials/tutorials.asp
That should get you started.

Share this post


Link to post
Share on other sites
ReaVeR-Andrey    199
I always use 3d for these cases: set FVF to something with D3DFVF_XYZRHW, turn off the z-buffer, lighting, and draw 3D lines that are actually 2D with some Z between 0 and 1. It works fine for me :)
The same with textures: create a "3D" rect and apply texture to it.

Share this post


Link to post
Share on other sites
Corsix    181
MSDN's DirectDraw7 reference can be found here: http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/ddraw7/directdraw7/ddover_7dx3.asp

Share this post


Link to post
Share on other sites
ReaVeR-Andrey    199
Quote:
Original post by evaclear
However DirectX 9 is fully backwards compatible with previous versions of directX.

Why then D3DXFont changed so much from original sdk to june 2005 update? My code won't compile because tha parameters have all changed.

[Edited by - ReaVeR-Andrey on July 19, 2005 2:48:09 PM]

Share this post


Link to post
Share on other sites
deadimp    310
Becasue you are using the DirectX 9 version of ID3DXFont and not the DirectX 8 version. There are many changes between the two, and example being that IDirect3DDevice8::SetVertexShader() is IDirecet3DDevice9::SetFVF().
As for drawing shapes and such, they weren't that hard to find out. Simply look at the D3DPRIMITIVETYPE enumeration (DirectX9) and you can find out a lot from that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this