Search code examples
c++directxdirectx-10direct3d10

Problems with creating a DirectX 10 device and swap chain


I am having some problems with creating a valid DirectX 10 device and swap chain using D3D10CreateDeviceAndSwapChain. I think it might be my window creation that something goes wrong in since it says that the OutputWindow in the supplied SwapChainDesc is unused=??? (or a random int value)

This problem has been stressing me out since I can't seem to find out what is wrong with the project code

I know that it fails at line 193 in CDirect3D.cpp at

result = D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &swapChainDesc, &this->m_swapChain, &this->m_device);

I would be very grateful if someone could take a look at the code. I've uploaded the project and its sources at http://dl.dropbox.com/u/3605545/files/LearningEngine.zip

(Not a huge codebase, only 4 classes so far)

The project is in VS2010 and I used the DirectX SDK from June 2010


Solution

  • I found the problem, I mistyped this line:

    swapChainDesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
    

    Should have been:

    swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;