Direct3D 11 tutorial

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
To be clear, this is using the DirectX SDK tutorial that is included in the documentation.

Any help would be greatly appreciated!
Does anyone know DirectX11?
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.
I'm getting no error messages, the D3D11CreateDeviceAndSwapChain simply returns failed (when I check the value of hr)
Topic archived. No new replies allowed.