3

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

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
SorenA
  • 127
  • 1
  • 1
  • 11
  • What code is returned? The error in `result` should point you in the right direction: http://msdn.microsoft.com/en-us/library/bb205278(v=vs.85).aspx – AJG85 Aug 08 '11 at 23:50
  • I was trying the code from http://www.rastertek.com/dx10tut03.html and the code provided on the side have a NULL passed as adapter, yet it works – SorenA Aug 09 '11 at 00:10
  • 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;` Was hard to spot. Anyways, thanks for the help – SorenA Aug 09 '11 at 00:30

1 Answers1

3

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;
SorenA
  • 127
  • 1
  • 1
  • 11
  • 1
    +1: For good eyes because I looked at that about 4 times before I saw the difference. – AJG85 Aug 09 '11 at 15:30