Jul 6, 2012 at 4:01am Jul 6, 2012 at 4:01am UTC
Just trying to start the Direct3D11 tutorial, but the first practice source code is failing.
I have researched what I could, linked it correctly, added/mapped the correct libraries, includes, &c.
Through some debugging I found the troublesome function to be :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
...
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory( &sd, sizeof ( sd ) );
sd.BufferCount = 1;
sd.BufferDesc.Width = width;
sd.BufferDesc.Height = height;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = g_hWnd;
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;
for ( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ )
{
g_driverType = driverTypes[driverTypeIndex];
hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels,
D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext );
if ( SUCCEEDED( hr ) )
break ;
}
if ( FAILED( hr ) )
return hr;
...
Ironically, the D3D11CreateDeviceAndSwapChain is the first function discussed in the D3D11 tutorial.
If anyone has any advice, needs more context/code, (or knows the location of the probably easier D2D tutorial) please post!
Last edited on Jul 9, 2012 at 5:00pm Jul 9, 2012 at 5:00pm UTC
Jul 6, 2012 at 10:38pm Jul 6, 2012 at 10:38pm UTC
To be clear, this is using the DirectX SDK tutorial that is included in the documentation.
Any help would be greatly appreciated!
Jul 9, 2012 at 4:58pm Jul 9, 2012 at 4:58pm UTC
Does anyone know DirectX11?
Jul 10, 2012 at 2:46am Jul 10, 2012 at 2:46am UTC
Use the D3D sdk its there for you and me. There is no getting around using the sdk. It is not perfectly engineered for the programmer. It is the programmers job,you and me, to set it up in a way that is useful. As for your code i do not see anything problematic. Are you getting a linker error? Post the error codes the compiler is giving you. It might be a semantic error or it might be a runtime error, post your error codes.
Jul 14, 2012 at 3:33am Jul 14, 2012 at 3:33am UTC
I'm getting no error messages, the D3D11CreateDeviceAndSwapChain simply returns failed (when I check the value of hr)