-
D3DFrameWork example
Ok, I've got the framework class done.
As it is all you need to do to get D3D up and running is simply run the code as is. This is only the EXE right now - I'll release the sources later.
I want to test this on several systems before I release it to the newbs for game dev.
The last thing we need is this board to get flooded with posts about why the framework doesn't work.
The idea here is that you simply have 3 functions for the game.
Setup() - all setup is done here
Display() - scene is drawn here
Shutdown() - everything allocated in setup is released here.
Upon exiting the message loop the framework will shutdown and release the IDirect3DDevice9 pointer as well as delete the global D3D9 object. The IDirect3D9 pointer is relased shortly after creation inside of D3DFrameWork::Init().
All you must do to use this framework is to add code to Setup(), Display(), and Shutdown(). I took this idea from one of my books....but I revised it a little bit. There is a global D3D9 object that represents the entire device. It is global for simplicity sake and not much would be gained by hiding it.
Please test this code as is to see if it works on your system. It should fire up Direct3D, clear the screen to black and sit there. Press ESC to exit the program.
You should not receive any errors from Windows about this program when it closes. If you do...let me know.
After I verify that it works well on most systems (it should work on all) I will place the framework inside of a DLL and you will simply need to d/l the DLL and link with it in your projects. This will protect my framework code from needless tampering.
-
-
Worked for me as well, as long as you don't alt + tab or alt + enter.
-
Yup, worked for me to. :D
-
Yeah, ALT-Tab/Enter is not supported as of yet. Not hard to fix though.
Only one person so far has had issues with the code and that is probably due to the stencil buffer format and/or the pixel format being used.
If you could provide your system specs in your responses it would greatly assist me.
Looks like it will work on quite a few systems though.
-
Barton 2500 @ 2.1GHz
1GB PC2700
GeForceFX 5900SE 128 MB
-
Works fine.
Athlon XP2800
1GB PC2700
Radeon 9800Pro 128MB
-
AMD XP 2200+
512 mb ram
RADEON AIW 7500
-
Athlon XP +3200 @ 2.2Ghz
1024 MB RAM
GeForce 4 ti 4200
-
So....did it work sand_man? I don't see any post about if you tried it or not. I'm assuming it did since you provided the specs.
-
lol
yeah sorry it worked fine dude.
-
Bubba, shouldnt you be asking for the screen resolution and depth? i dont think knowing their RAM and CPU speed is gonna help much... (just a suggestion :))
and yeah worked for me,
1024x768 at 32 bit geforce fx 5600
EDIT: for the stencil buffer problem the other guy had, why dont you do something like this:
Code:
if (g_D3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DisplayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D32) == D3D_OK)
{
g_PresentParameters.EnableAutoDepthStencil = true;
g_PresentParameters.AutoDepthStencilFormat = D3DFMT_D32;
Debug.LogInfo("<li>32-bit depth buffer selected");
}
else if (g_D3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DisplayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D24X8) == D3D_OK)
{
g_PresentParameters.EnableAutoDepthStencil = true;
g_PresentParameters.AutoDepthStencilFormat = D3DFMT_D24X8;
Debug.LogInfo("<li>24-bit depth buffer selected");
}
else if (g_D3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, DisplayMode.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D16) == D3D_OK)
{
g_PresentParameters.EnableAutoDepthStencil = true;
g_PresentParameters.AutoDepthStencilFormat = D3DFMT_D16;
Debug.LogInfo("<li>16-bit depth buffer selected");
}
else
{
g_PresentParameters.EnableAutoDepthStencil = false;
Debug.LogInfo("<li>No depth buffer selected");
}
I use it in all my dx apps, and they run fine on all comps, well all the comps that i know of anyway...
-
Yeah I'm not cycling through all of the formats...but that is to come.
-
Worked just fine for me.
AthlonXP 1900+
WindowsXP
GeForce3
1024*768*32, if your program uses desktop resolution