HELP with DX9 Errors!!!

This is a discussion on HELP with DX9 Errors!!! within the Game Programming forums, part of the General Programming Boards category; I am having a hell of a time trying to figure out why I get these weird errors. I bought ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    118

    HELP with DX9 Errors!!!

    I am having a hell of a time trying to figure out why I get these weird errors. I bought the book 'Beginning Game Programming' by 'Johathan S. Harbour' and really think it is one of the best books I have purchased, and i've purchased lots in the last year or so. I know C++ well now and am following everything in the book so far without problems. Also, i'm not new to DirectX as I have made a Tile Engine with Direct X 8, and now want to learn Direct X 9 as I hear it is much easier and required much less code, especially with the helper functions. My problem is I have had errors pop up when trying to compile the code given on the included CD. Every direct X program works perfectly until I hit chapter 8. I have done everything, including uninstalling Direct X 9 and reinstalling it again. Also, it is the only SDK on my computer as I have uninstalled them before installing 9B. The errors I get are listed below:

    --------------------Configuration: redonex9 - Win32 Debug--------------------
    Compiling...
    winmain.cpp
    dxgraphics.cpp
    game.cpp
    c:\scratch\........thisdx9\game.cpp(97) : error C2065: 'D3DXSPRITE_ALPHABLEND' : undeclared identifier
    c:\scratch\........thisdx9\game.cpp(116) : error C2660: 'Draw' : function does not take 5 parameters
    Error executing cl.exe.

    redonex9.exe - 2 error(s), 0 warning(s)

    Any help would be greatly appreciated, thanks in advance!

    Tommaso
    "The distinction between past, present and future is only an illussion, even if a stunning one."
    -Albert Einstein

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    ID3DXSprite was changed in DirectX 9.0c Oct 2004 and beyond. You need to get updated docs and/or link with the older DX import libs and headers.

    You must be sure that:

    1. Your headers/libs match your DX version on your machine.
    2. Your documentation matches your header/lib versions.
    3. The DX documentation has some errata in it. Check google for more information. AFAIK ID3DXSprite documentation is correct. However I know that SetRenderTarget() and examples using it in the docs are NOT correct. I'm sure there are more errors as well.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    118
    Could I just install DirectX 9B and keep the DirectX9B SDK?

    Is it possible to downgrade directX?

    I'm a little confused, which is nothing new. I already have 9B SDK installed, but my version of DirectX is 9C (Not the SDK), the newset one. Does this make any difference or cause any problems?

    Thanks for the help, I am really getting frusterated and any info makes my day.

    Tommaso
    Last edited by Tommaso; 02-03-2006 at 07:51 AM.
    "The distinction between past, present and future is only an illussion, even if a stunning one."
    -Albert Einstein

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    No.
    No.
    Yes.

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    118
    How can I remove DX9C (Not the SDK) and reinstall DX9B. That way my DX9B SDK will match my OS DX version. This will solve my problem, right? Also, does that mean the code I am learning is obsolete? In your opinion am I better to continue programming for DirectX 8.1, or keep plugging away at DX9? I have many game programming books on DX8.1 and 7, but they seem to be so much different (code wise) than DX9. Sorry for all the questions, I'm really getting desperate. I usually figure problems out on my own without bothering others, but this has proved to be impossible for me. I've already wasted three nights screwing with the code and installing and uninstalling. Thanks again!

    PS: The book I am using to learn DX9 (and where i'm getting the uncompilable code) is called 'Beginning Game Programming' by 'Jonathan S. Harbour'.

    Tommaso
    "The distinction between past, present and future is only an illussion, even if a stunning one."
    -Albert Einstein

  6. #6
    Yah. Morgul's Avatar
    Join Date
    Feb 2005
    Posts
    109
    Why wouldn't you want to use 9c? Even if the book is using 9b (I'm assuming that is why you want to use b so badly), the difference between the two isn't astounding. So a couple functions take differenent parameters, it shouldn't be that hard to figure out. MSDN is fairly up-to-date so most functions are on there.

    And you should definitely not got back to DX8. We are all going to be moving on to DX10 soon so learning more of 8 would be a really, really bad idea.
    Sic vis pacum para bellum. If you want peace, prepare for war.

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    How can I remove DX9C (Not the SDK) and reinstall DX9B. That way my DX9B SDK will match my OS DX version. This will solve my problem, right?
    Well you cannot install an older version of DX over a newer version. This has been true ever since the invention of DX. You can uninstall DX and re-install an earlier version, but this is sugar coating the problem and isn't what you need. Besides if you do that and ever want to take a break and play some games, they will want the newest version of DX9. Also drivers are updated to work with the current version of DX so by downgrading and not downgrading the driver can cause major issues.

    Also, does that mean the code I am learning is obsolete?
    Yes. However DX is supposed to be backwards compatible for all versions. This is relatively true down to DX4 or so and then it gets a bit fuzzy. There is not much difference between 8 and 9, 9 and 9c. There are readme files and help files that document the changes. I have an old book about special effects programming that uses DX 8.1 and porting them hasn't been all that difficult.
    Concentrate on concepts in the book and porting it shouldn't be too hard. Don't discard your book simply because it's older code.
    Concepts never get old.

    In your opinion am I better to continue programming for DirectX 8.1, or keep plugging away at DX9?
    Program for DX9. As I said the differences are minor and really come down to adding a parameter or taking one away from certain DirectX calls. Either version will teach you a lot.


    I have many game programming books on DX8.1 and 7, but they seem to be so much different (code wise) than DX9.
    Well 7 is much different than 8, but 8 is much closer to 9 than 7 is 8...if that made sense. The main things that have changed in 9 are certain D3DX COM interfaces. Most of core DirectX has not changed much. 7 is far different than 8 or 9 because I do not think it supports fixed function pipeline shaders through the use of SetTextureStageState() calls. I believe those were introduced in version 8.

    Sorry for all the questions, I'm really getting desperate.
    Your questions are all valid. It's obvious you have fought this thing and actually tried to resolve the issue on your own. We don't mind answering questions when you have shown an effort.

    I usually figure problems out on my own without bothering others, but this has proved to be impossible for me. I've already wasted three nights screwing with the code and installing and uninstalling. Thanks again!
    You are not bothering us. This is what the board is all about. We've all been there at one time or another - especially with DirectX. Once you get it though, it really comes down to just learning what interface to use for the task at hand. DirectX is really quite simple and quite easy to use.

    PS: The book I am using to learn DX9 (and where i'm getting the uncompilable code) is called 'Beginning Game Programming' by 'Jonathan S. Harbour'.
    I've never read the book so I can't comment on it. There is a new book coming out from Frank Luna called Beginning DirectX Game Programming 2nd edition. The web site for it is www.moon-labs.com. I would encourage you to get the first edition which is available at www.amazon.com and when the second one comes out - snatch it as well. Also buy as many books as you can on all aspects of game programming as you will find that you will get a broader understanding by reading different explanations of the same topic from different authors. One book won't answer all your questions and none of them will go as deep as you would like. They are aimed at a general audience of game programmers and it would be impossible to write one book that covered all topics available in great depth. So....get as many as you can afford. I've read over 20 in 6 months and just ordered another book on pixel shaders. So I now have 4 books dedicated to pixel shaders and 3 of my other DX books cover them briefly. I have books on sound, multiplayer, game logic and AI, game engine structure, game physics, calculus, vector math, graphics techniques, C/C++, PHP, HTML, DOS tech refs, Intel tech refs (IA32 and IA64), assembly, operating system design and implementation, and loads more.

    The more the better.


    Don't give up. It's well worth it.
    Last edited by VirtualAce; 02-03-2006 at 11:35 PM.

  8. #8
    Registered User
    Join Date
    Jun 2006
    Posts
    1
    I bought the same book, the book actually comes with 9c of direct x. to fix the problem just leave out the D3DXSPRITE_ALPHABLEND so it would look like sprite_handler->Begin(); , and the draw function takes 7 parameters now, which are ;

    LPDIRECT3DTEXTURE9, RECT, D3DVECTOR2, D3DVECTOR2, FLOAT, D3DVECTOR2, D3DCOLOR

    so the code in the book would be changed to
    Code:
    sprite_handler->Draw(caveman_image, &srcRect, NULL, NULL, 0.0f, &position, D3DCOLOR_XRGB(255,255,255));

    also you will need to change the line where you create the position from

    Code:
    D3DVECTOR3 position((float)caveman.x, (float)caveman.y, 0);
    to
    Code:
    D3DVECTOR2 position((float)caveman.x,(float)caveman.y);
    Notice there is no 3rd parameter

    This should allow you to compile.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  2. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 08:00 AM
  3. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  4. DX9 and Dev-C++
    By Ashes999 in forum Windows Programming
    Replies: 5
    Last Post: 06-10-2003, 12:19 AM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 05:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21