none
Could not create Direct3D surface. Please ensure the DirectX runtime is installed. (on a PC, Runtime error)

    Question

  • Before I begin explaining my problem, I want to clarify what makes this topic unique: I am getting this error on a Windows 7 Enterprise PC and not on BootCamp (cf. topic: "Using Kinect SDK on Boot Camp (iMac)").

    I have just installed Microsoft Visual Studio 2010 Ultimate, Microsoft Kinect SDK and DirectX SDK (June 2010).

    The Kinect is up and running and the sample application "SkeletalViewer" works very well in C #. However, the C + + version of that same application "SkeletalViewer" does not work at all. It compiles fine (Build succeeded) but at runtime (Ctrl + F5), once I start it, it gives an error: "Could not create Direct3D surface. Please Ensure the DirectX runtime is installed. "

    It should be noted that the documentation was followed with great precision during the installation process. In addition, as was suggested in the thread "Using Kinect SDK on Boot Camp (iMac)", I tried the direct3D samples and they all build and run successfully on Microsoft Visual Studio 2010. Furthermore, I tried setting up DirectX SDK with visual studio (by adding the static libraries) as was suggested in this link:

    http://takinginitiative.net/2010/07/02/setting-up-the-directx-sdk-with-visual-studio-2010/

    Nothing is working for me and since "SkeletalViewer" is the only NUI sample application in C++, I want to make sure it runs correctly before trying to create my own NUI application.

    I would greatly appreciate any help on how to run this application successfully (the CPP version of the application of course).

    In order to provide information on my system, I posted the following screen shots on my website, please review them:

    •    Direct3D 9 Control Panel.jpg   (Important)
    •    DirectX Diagnostic Tool Graphic Card.jpg (Important)
    •    DirectX Diagnostic Tool.jpg (Important)
    •    Direct3D 10.x-11 Control Panel.jpg
    •    DirectX Diagnostic Tool 64 bits diagnosis.jpg
    •    DirectX Diagnostic Tool Graphic Card 64 bit Diagnosis.jpg

    Thank you in advance for your help,

    Joseph

     

    Monday, July 11, 2011 1:10 PM

Answers

  • Joseph, what is the "hr" value returned by m_pD3D->CreateDevice? Maybe it is D3DERR_NOTAVAILABLE (0x8876086a) or D3DERR_OUTOFVIDEOMEMORY (0x8876017c)? If the error is D3DERR_NOTAVAILABLE, then maybe it will work to change D3DCREATE_HARDWARE_VERTEXPROCESSING with D3DCREATE_SOFTWARE_VERTEXPROCESSING, or changing some of the other creation flags similarly. It could be that your video card doesn't support something that our sample is trying to use.

    Please report back with results so we can either document this or update sample to be more forgiving.

    Sorry about any time you've lost so far,
    Eddy


    I'm here to help
    • Marked as answer by JosephBak Wednesday, July 13, 2011 12:37 PM
    Tuesday, July 12, 2011 9:21 PM
    Owner

All replies

  • Joseph,

    This message actually corresponds to string resource IDS_ERROR_D3DCREATE of SkeletalViewer application, and may be output from two places in Nui_Init method in NuiImpl.cpp:

    1) After failure creating D3D device for depth stream
    2) After failure creating D3D device for RGB video stream

    Could you step through Nui_Init method in debugger and see where failure happens? I'm guessing that it is case #1 (depth stream), but just want to confirm. After you confirm this, could you step into DrawDevice::CreateDevice method and see where exactly the failure is returned? That will provide a better clue as to what the problem was so I can help you further.

    Eddy


    I'm here to help
    Tuesday, July 12, 2011 4:03 AM
    Owner
  • Eddy,

     

    First, thank you for taking the time to help me.    

     

    I have debugged as you suggested and found that the error originated from the method call

     

        hr = m_DrawDepth.CreateDevice( GetDlgItem( m_hWnd, IDC_DEPTHVIEWER ) );

     

    at line 88 in the file “NuiImpl.cpp” and at line 18 inside the method Nui_Init() as you said.

     

    When I stepped into this method, I found that the error is occurring at the last test after this method call at line 116 in DrawDevice.cpp (which is line 46 in the DrawDevice::CreateDevice method definition):

     

     hr = m_pD3D->CreateDevice(

            D3DADAPTER_DEFAULT,

            D3DDEVTYPE_HAL,

            hwnd,

            D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE,

            &pp,

            &m_pDevice

            );

     

        if (FAILED(hr)) { goto done; } //This is where the error is being detected

     

    In this if clause, “FAILED(hr)” is returning true and the instruction in the if clause is being executed therefore bypassing the next instruction on line 127:

     

        m_hwnd = hwnd; //This instruction is not being processed

     

    and going directly to line 130 to execute the following instruction:

     

        return hr;

     

     

    Do you have any suggestions on how to fix the error?


    Thanks again for your help,

     

    Joseph.

    Tuesday, July 12, 2011 12:21 PM
  • Not that it is related, but I had encountered a similar problem, but that was my oversight of a few things. I had one of these lines commented in SkeletalViewer.rc and that caused the IDC_ERROR_D3DCREATE error

    //CONTROL "",IDC_DEPTHVIEWER,"Static",SS_BLACKFRAME,8,16,640,480

    //CONTROL "",IDC_VIDEOVIEW,"Static",SS_BLACKFRAME,656,16,640,480


    Tuesday, July 12, 2011 5:19 PM
  • Joseph, what is the "hr" value returned by m_pD3D->CreateDevice? Maybe it is D3DERR_NOTAVAILABLE (0x8876086a) or D3DERR_OUTOFVIDEOMEMORY (0x8876017c)? If the error is D3DERR_NOTAVAILABLE, then maybe it will work to change D3DCREATE_HARDWARE_VERTEXPROCESSING with D3DCREATE_SOFTWARE_VERTEXPROCESSING, or changing some of the other creation flags similarly. It could be that your video card doesn't support something that our sample is trying to use.

    Please report back with results so we can either document this or update sample to be more forgiving.

    Sorry about any time you've lost so far,
    Eddy


    I'm here to help
    • Marked as answer by JosephBak Wednesday, July 13, 2011 12:37 PM
    Tuesday, July 12, 2011 9:21 PM
    Owner
  • Eddy,

    It worked… Replacing D3DCREATE_HARDWARE_VERTEXPROCESSING with D3DCREATE_SOFTWARE_VERTEXPROCESSING solves the problem.

    Thank you very much for all your help… May JESUS CHRIST bless you…

    N.B.: the “hr” value that was returned by

        hr = m_pD3D->CreateDevice(

            D3DADAPTER_DEFAULT,

            D3DDEVTYPE_HAL,

            hwnd,

            D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE,

            &pp,

            &m_pDevice

            );

    Is

    -2005530516

    According to the debugger.

    Note that this value is returned only when D3DCREATE_HARDWARE_VERTEXPROCESSING is set and that this “hr” value of -2005530516 was responsible for the error that was being generated.

    Hope this is useful. If you want any more information about the error, please post a reply on this thread and I will be glad to provide you with the information you need.

    Wednesday, July 13, 2011 12:37 PM
  • Great! I'm glad I could help you :)

    -2005530516 corresponds to hex value 0x8876086C, which means D3DERR_INVALIDCALL (from d3d9.h). Useful to know for next time.

    Let me know if you run into more problems.
    Eddy


    I'm here to help
    Wednesday, July 13, 2011 10:39 PM
    Owner
  • Hi,

    I had the exactly same error, and I tried to solve it like Joseph.

    But what happens is that the program does not present any error messages, and depth camera kept frozen with the initial frame. Any ideas?

    Thanks,

    Rafael

    Wednesday, November 16, 2011 4:25 PM