Sign in to follow this  
Thanhda

is DX backwords compatible?

Recommended Posts

i'm a total noob with api's, i just wanted to know if DX was backwords compatible. if i program my code in DX8, can it work in DX9? i was told that they got rid of directdraw and replaced it with direct3d. also is OGL backwords compatible?

Share this post


Link to post
Share on other sites
Yes, DX is backwards compatible. I think it only goes back as far as DirectX 4..but I could be wrong. Though I don't think code for DirectX 1 even exists anymore. (From what I heard of it, I hope it doesn't =)

My graphics engine is 2d and runs in DirectX 7 (cause it's all DirectDraw and DirectDraw doesn't exist after DX7). I use the DirectX9 SDK, but all the old code still works. You just gotta be consistent.

Good luck.

Share this post


Link to post
Share on other sites
really? i see i just created some code from this book i have that uses DX8, it compile fully. but when i try to use .net with DX9 SDK at my school, i get all these errors. this is just concernning. i'm currently trying to build a small basic engine that may posibly get bigger, i just dont want to have my code become obsolite, and not usable in future SDK's, or have to reprogram like 500 lines of code. my next question is OGL backwards compatible?

Share this post


Link to post
Share on other sites
This is an error that drove me away from game programming for a whole year, so I will try to steer you away from it if it is in fact what's happening to you.

Make sure that whatever IDE you're using has its include directories set properly. So long as it knows to include your DXSDK folders, your DirectX legacy code *will* compile.

That is, if your code is correct.

Share this post


Link to post
Share on other sites
well i'm currently inrolled at toronto's game design and development, and they have DX9 SDK installed, our class hasnt really touch DX yet, but i have. i got some nice books based on DX8, and by testing if it works, i compile the DX code from the books on my PC, it works fine with the DX8 SDK, but when i tried to compile it at my school, it doesnt. not sure why.

Share this post


Link to post
Share on other sites
Again, check that the include directories on your target system's IDE is set properly. I have only the DirectX 9 SDK, and I am constantly compiling DirectInput8 code and DirectDraw7 code. I promise it works.

If it compiles on your home system, the include directories for your *Project* on the school system are incorrectly set. When you load up on the school computer, check your personal session settings. If it is MSVS, or a derivative, it's under Tools..Options..Directories. Add DXSDK/INCLUDE to the include list...you'll also have to add the header directory in the same way.

Share this post


Link to post
Share on other sites
I'm not familiar with OpenGL, but am very familiar with DirectX. I HIGHLY recommend using Direct3D instead of DirectDraw. Whether to use 8 or 9 is not so important; use 9 if possible, but using 8 should be fine; it only took me a few days to update my fairly large D3D 8 game engine code to 9, anyway, albeit minor problems.

I had a terrible experience when I tried running my old DirectDraw engine on my new (at the time) WinXP machine over a year ago. I wrote it using DX 6.1, and WinXp comes with 8. Primarily, the graphics were drawn all screwed up, but it worked fine on my old Win 98SE PC. Even the good people of GameDev.net couldn't offer help. I gave up on DirectDraw and spent the next eight months converting to D3D 8 and taking a big sanity break. Innumerable problems almost led me to abandon my game project, though I did get through it ultimately.

In short: Use Direct3D over DirectDraw, unless you enjoy pain!

Best wishes. :)

Share this post


Link to post
Share on other sites
To be fair, I have to say DirectDraw is a *lot* simpler to understand than Direct3D. Having tried both I admit that I've put off another foray into 3d land until I get beefed up on my calculus. 2d's just fine for me, and DirectDraw surfaces - while they take some getting used to - really aren't that bad for the beginner.

Though there are admittedly few of us left who understand DirectDraw at all. =) I'll try to answer whatever questions you have about it when they come up. Andre Lamothe's book is good, as I said, and also all the documentation you could ever ask for (and more) can be found on MSDN.

Share this post


Link to post
Share on other sites
if the errors got something to do with unicode lpcwstrings etc then i strongly recommend taking the school's computer, drive to redmond and shove it up the *censored* ... well, i'm not really happy with the new dx9 as you can see... i tried to use it some time ago and used a small example i made before in dx8 and tried to change all 8s into 9s and i changed the project's properties to unicode. but it wouldn't compile. now i hate dx9 but i guess it's just something small i overlooked in my rage. as soon as i have time i'll see what i can do to get it running. if not i'll go back to ogl.
Quote:
Original post by BrianMJC
Whether to use 8 or 9 is not so important; use 9 if possible, but using 8 should be fine; it only took me a few days to update my fairly large D3D 8 game engine code to 9, anyway, albeit minor problems.
Best wishes. :)
i guess i did something wrong... i had big problems with the update :/
maybe i suck... yeah, that's the reason :|

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
People are becoming too touchy feely on this thread and is forgetting to answer the question... ahem...

So here is the low down.

DirectX inherits from COM (now replaced by NET) so that all your previous COMPILED DirectX programs SHOULD run on new versions of DirectX. That is the COM specification.

It is an entirely different thing when you are trying to compile legacy source code under the new DirectX SDKs even if you do specify that the headers and libs you want are that of previous versions. Been there, done that, it simply will not work or will not work very well.

If you are using DirectX8 however, the good news for you is that the API changed little and it should not be very difficult to port it over to the latest DirectX9 SDK.

Share this post


Link to post
Share on other sites
If you write a program in DirectX 8 or DirectX 7 or DirectX 5 etc it will run in a system using DirectX 9.0.
Now about source code: The is a great change to Direct3D interface functions from DirectX 7.0 to DirectX 8.0 (functions like DrawPrimitive, DrawPrimitiveIndexed, etc) witch the number and type of parameters has changed. So not only initialization is different, but also a lot of function. If you have a program written in DirectX 7.0 you need a major rewrite to port it to DirectX 8.0 / DirectX 9.0.

Share this post


Link to post
Share on other sites
What is made with DirextX7 will work on all versions IF the interface calls are made the right way. Converting is not needed, since it wont make a difference. Directx is COM based and thats why its backward compatible (if you dont know what com is, ask, and i will explain :) )

Share this post


Link to post
Share on other sites
Well... i can just give you a basic walktrough on com (if im making a mistake people, please correct it for me :) )

COM (Component Object Moddeling) is a nice technology. With com, it is very easy to update programs, and it even allows you to use a previous version of a program. it works like this: Directx is updated (say version 7 is updated to 8). problem is, sometimes they change parts of the programs so much, that your program wouldnt work. The nice thing about directx is that its based on com technology.

every new version they create a new interface you can use (an interface can be seen as a version control for the program. all the information on how that version works, is in it). if you want, you can use the newest version by asking the program for that interface, and directx works as if it is that version (you can even ask it to be version 1 (not recommended) )

Because of that changes in the new versions, it can happen that they change the code a bit. instead of asking something like 3dinfo(doesnt excist), you need to ask info3d. very nice, but the new version doesnt understand what u mean with 3dinfo. and there the interfaces come in handy. insead of changing all your code to the new version, you can just say to directx you want it to act as if it was version 7. in version 7, our example 3dinfo still excisted, and so the program does understand it.

however, be aware that an old version cant use the new things. if they added better music support in a newer version, and u use an old version, that will also not be availible.

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