?
Solved

DirectX7 vs DirectX9

Posted on 2003-02-21
3
Medium Priority
?
721 Views
Last Modified: 2008-01-09
Hey Everyone:

I'm looking for a good book to teach me to develope a game with DirectDraw (2D platform), and have been searching for a good book...the only book I found with good reviews has been for DirectX7.  Could I use this book to help me develope for DirectX9 DirectDraw?  All id have to do is pretty much change the '7' in all the types to a '9' and then just include the ddraw.lib and ddraw.h to get it to complie and run, right?  Thanks

Ernie
0
Comment
Question by:fastawdtsi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
scerveza earned 400 total points
ID: 7995667
No, DirectX 7 is totally different than DirectX 9. That's the bad thing about DirectX. I have a DX7 game programming book and it's totally obsolete unless you want to use DX7 interfaces under DX9.

With DX8, DirectX went under a major reconstruction. The DX7 renderer was based on a blitter. The DX9 renderer is based on a scene render. Microsoft chucked the IDirectDraw7 interface replaced it with the IDirect3D9 interface, which is totally different.

For one, DX7 had Blt functions (for 2D and 3D rendering),
but DX9 does not. DX9 is more like OpenGL now with  BeginScene and EndScene functions:

// begin scene
d3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0, 0);
g_pd3dDevice->BeginScene();
// do some rendering
// end scene
d3dDevice->EndScene();
d3dDevice->Present(NULL, NULL, NULL, NULL);

In DX7, this is rendering code:

while(TRUE)
{
 // blt the surface to the screen
 // for both 2D and 3D cases
 result = primary->Blt(&destRect, offscreen, &rect, 0, NULL);

 if(result == DD_OK)
    break;
 if(result == DDERR_SURFACELOST)
    if(!RestoreAll()) return;
 if(result != DDERR_WASSTILLDRAWING)
    return;
}

Now, if you want to program 2D games with DX9 it is very possible. All the blitting code was moved to the Direct3D Extension (D3DX) Libary. You use the D3DXCreateSprite function to draw 2D images onto the screen.

So i guess my answer to your question is... your DX7
book is obsolete.
0
 

Author Comment

by:fastawdtsi
ID: 7995873
How about DirectX8, could I use a DirectX8 book to build DirectX9 code?  Thanks

Ernie
0
 
LVL 1

Expert Comment

by:scerveza
ID: 7996896
Yes, DX9 is pretty darn portable with DX8. As with every new DirectX release there are minor structure changes, minor function parameter changes, and new functions added. DX7 to DX8 was the last MAJOR structural change in DirectX. DX8 and DX9 share common interfaces and for the most part just replacing 8's with 9's won't generate too many errors, but you will get some depending with what you're working on. The concepts and interfaces between 8 and 9 are virtually the same.

Here is what Microsoft documents as the changes between 8 and 9:

Changes Between DX8.1 and DX9
---------------------------
BaseVertexIndex Changes
CreateImageSurface Changes
D3DENUM_NO_WHQL_LEVEL Changes
EnumAdapterModes Changes
Get/SetStreamSource Changes
Handles
Multisampling Quality Changes
ResourceManagerDiscardBytes Changes
SetSoftwareVertexProcessing Changes
Texture Sampler Changes
Vertex Declaration Changes
Vsync, Intervals, and SwapEffects Changes

As you can see these are not major structural changes. So yes, you can get by with a DX8 book and learn DX9. And the spots where there are changes, just look in the DX9 SDK help file. DX9 still uses FMVs, Vertex Buffers, and so on, and the concepts are the same between DX8 and DX9. However, DX7 is toooootallllly different (nasty long structures with multiple union members, different interfaces, different functions, and a smaller Direct3D Extension Library). DX8 and DX9 are really nice, and i've been using them. I started out with DX7 and all I can say is,"NAAAAAASTY!"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question