Topic : Directx Programming Intro
Author : Mark Klarer
Page : << Previous 2  
Go to page :


out of directx to see errors, etc.
m_pDDraw4->SetCooperativeLevel(hWnd, DDSCL_NORMAL);
break;
case WM_TIMER:
break;
}

return DefWindowProc(hWnd, nMsg, wParam, lParam);
}





Hope the code works for you OK. Any compile troubles, just drop me an email. So far I have responded to every one, some more helpful than others, sorry I dont know everything. You may have noticed that I used the simple program from the windows tutorial. The program is a Windows program, even though we are initiating a 3D card in fullscreen, full speed ahead, interesting, huh? Some other things you will notice is that DirectX uses callback functions for enumerating devices and display modes. I think the use of callbacks kind of makes DirectX a little ugly, oh well, it works. The next program in the tutorial will be "meatier" - a little more robust and user friendly, so the user can select the display modes and devices, and also trap errors. I deliberately ommited those elements in the above code in order to make the example as short as I could make it so you can see the structure of a working immediate mode DirectX program. Unfortunately, the code may not work on your computer unless you tweak it a little. Watch out for the devices and displays you enumerate. You may have a machine with far more devices and displays than what I have.

Those of you coming from studying DirectX before version 5 will wonder where the execute buffer is in my code. It aint there. DirectX 5 and above include "DrawPrimitive" commands, that effectively replace the execute buffer (thank you Microsoft). You no longer need to set up those big ugly execute buffers. As a matter fact, DONT USE EM, DROP EM! FORGET-ABOUT-IT. For new DirectX prgrammers who have never heard of execute buffers, forget I even mentioned them. Just go on blissfully programming using the DrawPrimitive commands.

Page : << Previous 2