Need help finding my problem...(DX8)

Started by
20 comments, last by Moe 21 years, 11 months ago
Hi all, I really don''t like having to ask for help finding a problem in my own code, but I just can''t seem to figure it out myself. I am trying to write a decent Direct 3D wrapper that can do all sorts of interesting things like anisotropic filtering and multisampling. The problem is that for some reason my CreateDevice() is failing, and I can''t find out why. I tried debugging it with the debug info cranked up to the max but all it says is something like:
quote: Direct3D8: (ERROR) :The specified mode is unsupported. CreateDevice/Reset Fails Direct3D8: (ERROR) :Failed to initialize Framework Device. CreateDevice Failed.
I can''t seem to figure out what exactly is not working. You can find my latest source code at: http://www20.brinkster.com/tyrannica/help 1.zip The code is well commented and fairly organized. The specific code that is giving me problems is in d3d.cpp. There is one other thing that is bothering me as well. Every time my program doesn''t run properly, it tells you with a nice, informative message box. The problem is that after the message box is closed, it does an illegal operation. From the little debugging that I have done, it appears that it has something to do with CD3DFont, not my code. Any ideas on whats causing this either? Moe''s site
Advertisement
Anyone?

If anyone can get the CreateDevice() code to work, it really would help!

Moe''s site
Your ScreenWidth/ScreenHeight should be appropriate values for a supported video mode. When I use 1024, 768 the code works.

You get access violation after MsgBox because you don''t have default constructor for FONT, and if your program tries to quit before FONT::Init is called, FONT object contains garbage which you are trying to clean in the destructor (like deleting font which is 0xcccccccc).

Another error is that it appears that my GF3 doesn''t support 32-bit depth buffer with 16-bit backbuffer, which is what you are trying to do. Using 16-bit for both helped.

Even after that program said "Init error" and quit. Good luck finding more bugs!
---visit #directxdev on afternet <- not just for directx, despite the name
Thanks very much! I will try to catch all the bugs before they propagate!

Just one thing - can I get you to post the contents of prototype.log? Its just a text based file that tells me everything that is going on and where things fail. It can be found in the logs directory of the zip file.
Moe's site

[edited by - Moe on May 4, 2002 5:53:09 PM]
Kick ass help by indirctX! Wish all d00d3s h3re where lik3 u!
Gl man
P.S. Moe check ur e-mail
~The fastest polygons are those you don''t draw...~

[edited by - PiXeLatiOn on May 4, 2002 6:40:44 PM]
-Da Mr.RaSt3RiZah-
Here goes: (with D3D fixes I mentioned)

  ---------- Logfile Created ----------ENG - Initialize() called.ENG - Configuration file succesfully openedENG - Configuration file is of correct typeENG - Windowed mode read: 0ENG - Resolution set to 800x600ENG - Color depth read in as: 16ENG - Multisample level read in as 0ENG - Background color set to 0 0 0ENG - ShowFPS set to 1ENG - FPS font color set to 128 255 255 255ENG - Configuration file closedD3D - D3DInitialize() calledD3D - Max Number of Simultaneous textures is 4D3D - Maximum anisotropy taps is 8D3D - Fullscreen mode selected D3D - D3DFMT_X8R8G8B8 supported D3D - D3DFMT_R5G6B5 supported D3D - 16 bit z-buffer and backbuffer supported D3D - 32 bit z-buffer and backbuffer supported D3D - Using 32 bit backbuffer and z-buffer D3D - Initialization succesful. ENG - Direct3D initialization successful.DI - InitDirectInput() calledDI - Direct Input interface successfully created DI - Direct Input Keyboard device created DI - Data format set for keyboard DI - Failed to set cooperative level for keyboard ENG - Direct Input initialization failed.  Exiting program.  

Apparently, my computer can''t handle BACKGROUND|NONEXCLUSIVE flags for DI coopmode, which causes a lot of programs I see on GameDev fail to init on my machine. Did you get this flag combination from some book? It seems pretty widespread. I see no reason to use BACKGROUND coop mode for games anyway. I personally use FORE|NONEXCLUSIVE for kb and FORE|EXCLUSIVE for mouse. After changin your coopmodes to my coopmodes I got blank screen with the fps counter that was showing... well, hard to say, but around 3000 fps.

May I also suggest that you start using PCH? You won''t believe how fast your project will compile with them.

Final log file (I didn''t change log entries, ie Z is really D16):

  ---------- Logfile Created ----------ENG - Initialize() called.ENG - Configuration file succesfully openedENG - Configuration file is of correct typeENG - Windowed mode read: 0ENG - Resolution set to 800x600ENG - Color depth read in as: 16ENG - Multisample level read in as 0ENG - Background color set to 0 0 0ENG - ShowFPS set to 1ENG - FPS font color set to 128 255 255 255ENG - Configuration file closedD3D - D3DInitialize() calledD3D - Max Number of Simultaneous textures is 4D3D - Maximum anisotropy taps is 8D3D - Fullscreen mode selected D3D - D3DFMT_X8R8G8B8 supported D3D - D3DFMT_R5G6B5 supported D3D - 16 bit z-buffer and backbuffer supported D3D - 32 bit z-buffer and backbuffer supported D3D - Using 32 bit backbuffer and z-buffer D3D - Initialization succesful. ENG - Direct3D initialization successful.DI - InitDirectInput() calledDI - Direct Input interface successfully created DI - Direct Input Keyboard device created DI - Data format set for keyboard DI - Cooperateive level set for keyboard DI - Keyboard acquired DI - Direct Input Mouse device created DI - Mouse data format set DI - Cooperative level set for mouse DI - Mouse acquiredDI - Direct Input initialization succesful.ENG - Direct Input initialization succesful.ENG - Font initialized.ENG - EngineInitialize() successfully completed.---------- Program Successful ----------DI - ShutdownDirectInput() called.D3D Shutdown called. ENG - Shutdown() called.  


Thanks PiXeLatiOn. For some reason I like to debug code sometimes. Hate to debug my own though.
---visit #directxdev on afternet <- not just for directx, despite the name
Its really good to hear that someone got this working! I still have to make a few changes to get things working. The strange thing is that I can get it to run at 1024x768 but not at 800x600 or 640x480. I will have to play around and get things running...

Thanks!

EDIT - I did a little playing around and I fixed the illegal operation problem, but I still can't get CreateDevice() to work properly! IndirectX, can I get you to e-mail me d3d.cpp (rcjbvermilion@hotmail.com).

You said I should be using PCH (Pre-Compiled Headers, right?) I really haven't seen any information on how to do this. How would I go about doing this?

As for the BACKGROUND | NONEXCLUSIVE flags, I got that from furby100 (as far as I remember). He wrote a small tutorial on Direct Input, and thats where 90% of that code comes from. I just modified it to suit my purposes. I do understand it though. If I didn't, I probably wouldn't be using it. I don't like using code that I don't understand.



[edited by - Moe on May 4, 2002 10:45:58 PM]
Sent it your way from my other email account.

Look at project settings-(for .cpp files)-c/c++-Precompiled headers. stdafx.cpp creates pch file, other .cpp files use it.
---visit #directxdev on afternet <- not just for directx, despite the name
Ah, thanks again!

Moe''s site
Hmm, I still can''t get things to work the way they are supposed to! If I manually set the resolution in the program (hard code it in) it works, but if I read it in from the .cfg file, it doesn''t work unless the resolution is something like 1024x768. I just can''t figure out why this stupid thing doesn''t want to work! I set the config file to 800x600, I check to make sure it was set to 800x600 in my logfile. Then I set the backbuffer dimensions using the read in variables, and low and behold - it doesn''t work! It has to be something in there that isn''t passing the variables on correctly or something.

Moe''s site

This topic is closed to new replies.

Advertisement