Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:54:19+00:00 2026-05-16T07:54:19+00:00

So, I started programming in DirectX11 today, I’ve had a lot experience with coding,

  • 0

So, I started programming in DirectX11 today, I’ve had a lot experience with coding, but not specifically DirectX, so I went and look at some tutorials. All was going swell, I could initialize a window, set a background color, but then as soon as I tried to define a shader and draw an object, it just crashes on load. This code is extremely simple, and I’ve put it in a rar so you can tell me what’s wrong. I’m coding in Visual C++ Express Edition because I tried for hours yesterday to get OpenGL reference paths set up in Netbeans to no avail, so I’m not trying to get DirectX working there either yet. Here’s the code I have currently: http://www.mediafire.com/?i8w1trkx7c03qts

I also tried downloading and just running the provided exe in http://www.dx11.org.uk/3dcube.htm, to test if it’s my direct X or something, and that one gives me an error of “Failed to create D3D11 device”, which from their code is a failure to complete the “D3D11CreateDeviceAndSwapChain” command. So honestly, what am I doing wrong/what is happening? (And any help on how to set the directX library references up in netbeans would be a great help).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:54:20+00:00Added an answer on May 16, 2026 at 7:54 am

    It works for me 🙂

    I had to remove L prefix of some strings for compiling code:
    "shaders.hlsl", "WindowClass", "Our First Direct3D Program"

    Do you have .hlsl file in the same path than your executable?
    Also you can’t start the program from VS. You will need to launch the .exe from
    the explorer.
    But you can set an absolute path to your shader if you don’t want this behavior, like that:

    D3DX11CompileFromFile("C:\\Users\\Stringer\\Desktop\\DXTest\\shaders.hlsl", ...
    D3DX11CompileFromFile("C:\\Users\\Stringer\\Desktop\\DXTest\\shaders.hlsl", ...
    

    Edit:
    Also when creating a device or device/swapchain always use D3D11_CREATE_DEVICE_DEBUG
    in debug mode. This will print in VS Output Window helpful warnings and errors (everything looks OK on my side).

        D3D11CreateDeviceAndSwapChain(NULL,
                                      D3D_DRIVER_TYPE_REFERENCE,
                                      NULL,
    #ifdef _DEBUG
                                      D3D11_CREATE_DEVICE_DEBUG,
    #else
                                      0,
    #endif
                                      NULL,
                                      NULL,
                                      D3D11_SDK_VERSION,
                                      &scd,
                                      &swapchain,
                                      &dev,
                                      NULL,
                                      &devcon);
    

    Edit2:

    Also always check for error codes everywhere application can fail:

    ID3D10Blob* pErrorBlob = NULL;
    
    HRESULT hr = D3DX11CompileFromFile("C:\\Users\\Stringer\\Desktop\\\\DXTest\\shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, &pErrorBlob, 0);
    LPVOID pError = NULL;
    if( pErrorBlob )
    {
        pError = pErrorBlob->GetBufferPointer();
        // then cast to a char* to see it in the locals window
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 493k
  • Answers 493k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Actually both ArrayList and Vector are very bad choices here,… May 16, 2026 at 10:37 am
  • Editorial Team
    Editorial Team added an answer Yes, that's it -- it will work identically, otherwise. I… May 16, 2026 at 10:37 am
  • Editorial Team
    Editorial Team added an answer If you use the jQuery ajax() function you can specify… May 16, 2026 at 10:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I've started using DirectX 11 Compute Shader technology for GP-GPU programming. I had written
I started programming in C++. It was my first language, but I have not
I want to get started game programming in C/C++, or C# with DirectX or
When I first started programming, I wrote everything in main. But as I learned,
I'm learning DirectX from a book about game programming, and it uses the following
I started programming C# applications when the 1.0 framework was first released. I worked
Just started programming in C++. I've created a Point class, a std::list and an
I started programming in Java and then eventually moved to C++. I then noticed
I have just started programming in Objective-C, I understand it only partially supports method
Possible Duplicate: Haskell vs. procedural programming in the real world Few times I heard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.