Original Post
I'm trying to build a simple Direct3D application with C++. I've made countless D3D programs in other languages before, specifially VB.NET and C#. This is my first C++ program, and for some reason, the Device won't initialize no matter what I do, even when I copy the code out of a tutorial (which I KNOW works.) Here's the presentation parameters (sorry for the excessive commentation but I love ASCII art :P): And here's the code for creating the device: Do you see anything wrong with this? Another thing that COULD be causing the problem is this: I made a class called Graphics_Handler, containing the variables and code for creating a device. Then I made another class called a Viewport, which contains a reference to the Graphics_Handler and manages it a little better. Both classes are contained in separate header files, and the Viewport is created in the main CPP file. Is there a problem with this system? Any suggestions would be GREATLY appreciated. Thanks. [smile]
//=====SETUP THE PRESENTATION PARAMETERS FOR THE DEVICE===========//------------------
//==________=====================================/*|*/ ==_____====//
//==VARIABLE=====================================/*|*/ ==VALUE====//------------------------------------
l_D3Dpp.BackBufferCount= /*|*/ 1; // The number of Back Buffers.
l_D3Dpp.BackBufferWidth= /*|*/ pWidth; // The horizantal resolution.
l_D3Dpp.BackBufferHeight= /*|*/ pHeight; // The vertical resolution.
l_D3Dpp.BackBufferFormat= D3DFMT_UNKNOWN;// Backbuffer format.
l_D3Dpp.Windowed= /*|*/ pWin; // If false, the game runs fullscreen.
l_D3Dpp.SwapEffect= D3DSWAPEFFECT_DISCARD;; // D3DSWAPEFFECT
l_D3Dpp.AutoDepthStencilFormat= /*|*/ D3DFMT_D16;// The only format that works! ^_^
l_D3Dpp.EnableAutoDepthStencil= /*|*/ true; // Turn on the Z (depth) Buffer.
l_D3Dpp.hDeviceWindow= /*|*/ hWnd; // Choose the device handle.
//==CREATE DEVICE================================/*|*/============//------------------------------------
if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&l_D3Dpp, &g_pDDev ) ) )
{
return false;
}