GameDevCoder

DX11 I need to learn DirectX. The examples for Introduction to 3D Programming with DirectX 11 by Frank D Luna does not work. Can anyone help me

Recommended Posts

Thanks very much Infinisearch. I know you have been inputting greatly on this thread I made so for this I am incredibly grateful. I shall work through the info I have here now and from what I've read. Things should work out for me. Can I ask. Just 1 other thing, might you know how I can fix this https://ibb.co/hG0gSb ? As it's the only thing stopping the BOX thing working for me.

Share this post


Link to post
Share on other sites

I've just been able to download VS13 now. I tried another web browser (edge). i think my chrome browser is showing some odd behaviour of late so this affected my ability to download VS13 before regrettably. So this will be nice to try getting the examples working too now using VS13 as I think that book was created with VS13 also. Just thought i'd share the kind of good news. Well, hopefully this makes things better for me :).

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

The source from the book was made with VS2010.  BTW I found this: https://github.com/utilForever/DirectX

AS far as the errors in the picture goes, the first one should be included if d3dx is included.

edit - this has a more up to date version of effects11 than the above link: https://github.com/Microsoft/FX11/wiki/Effects-11

Edited by Infinisearch

Share this post


Link to post
Share on other sites
8 hours ago, GameDevCoder said:

I've just been able to download VS13 now.

8 hours ago, GameDevCoder said:

Well, hopefully this makes things better for me :)

So did you get things working?  Its been 8 hours, don't leave me hanging... I have a stake in getting you up and running.

 

Share this post


Link to post
Share on other sites

Sorry. I saw straight away when you posted (my phone i mean notified me that a post was made) but I was in a gaming sesh. Can I ask you have VS15 possibly?
VS13 or VS15 doesn't make too much difference maybe right? In order to getting it to work. I'm going to PM you something also now.

ps - i haven't got stuck in at the moment but tomorrow I will definitely be trying again. Not sure I'll be attempting it too much today. I aim to try a bit today but I'm not going to push myself like I have some evenings this week. It's just getting draining for myself. I will be 100% determined to try getting the BOX example working tomorrow though.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites
1 hour ago, GameDevCoder said:

VS13 or VS15 doesn't make too much difference maybe right?

This makes all the difference in the world.  Trust me if you want simplicity just use VS2013 with the DXSDK.  It took me like 15minutes to get things working once I installed everything.

 

If you're gonna use VS2015 then follow the instructions on the page you linked in the OP.

this: http://www.d3dcoder.net/Data/Book4/d3d11Win10.htm

Also you should download this: http://www.d3dcoder.net/Data/Book4/BlendDemo_win10_vs15.zip and see what changes were made to get it to work.

Share this post


Link to post
Share on other sites

Thanks InfiniSearch. That page gets me a bit lost though. I just get overwhelmed with what I need to do or just have no idea what is is I should be doing. As I don't think they give clear cut directions just guess work or vague directions. I'm not so confident with coding myself just yet. I'm a student also just to mention again if I hadn't done.

edit- re read your post and missed the 1st sentences. Wow, i will def try with VS13 then. thank you very much for saying. I hope I can get it working then. Will know tomorrow what I fall short on if I do that is. Won't be trying today now as is late for me.

edit2 - ive just been looking at that page again now that you linked about VS15 and windows 10. Which I knew of but haven't really followed for awhile as have just been trying to use stuff to get the examples working from posts by people from gamedev.net. I think I will have to give a go the stuff it says under the downloads section as I haven't attempted some of the things there. Like doing anything with the effect files etc. I will have an interesting day tomorrow. 

For examples 1-6 that I have made work and am just sitting on this BOX example (example 6.1) before moving on. I have managed to get the examples working before this BOX one so I have been able to get them working without any changes to the effects files. I might be at the point now where I need to do something with the effects files. 

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

So, ...... I GOT THEM WORKING!!!!!!!!!!

edit - just wanted to say this. I will have to go to bed now but during the course of tomorrow i'll edit this post again and will write how I got them working so that this might help others in a similar position. 

I know that over the course of 2 threads (One 12 months ago and this one made recently). There have been a number of people trying to help me get this working which I am very thankful to every person that offered help with trying to get this working for me.

I'd like to give two considerable mentions to community member Infinisearch who really helped me get this working. Over PM's that I started i'd like to say that from his guidance I have succeeded in getting the examples to work now. The other member Happy SDE who helped me in the past, a couple things from back then I used also which helped me get this working too. So was a culmination really.

I'll make a proper write up about the fix later today. I have to go to bed now.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

So this was how I got the Box example working. These actually works for the other examples for Introduction to 3d programming in directx 11 also so use this for other examples to that you wish to run.

Using Visual Studio 2013

1) Open the Box example. Right click on the project and click on properties. The screenshot will make this clear for you if not sure where this is. https://ibb.co/jfoKYG

2) At the top where it says configurations. Make sure that is set on 'All configurations'. Then click within configuration properties - VC++ Directories. You need to add some text into the exe directory, include directory and library directory. So select on each field one by one and paste inside of there, you can paste over anything that's already in there:

executable directory, paste in - $(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)

include directory, paste in - $(DXSDK_DIR)Include;  the location of your common folder for all these examples   ;$(IncludePath)

libriary directory, paste in - $(DXSDK_DIR)Lib\x86;  the location of your common folder for all these examples   ;$(LibraryPath)

Then click 'apply' to keep all that has been entered.  Click 'ok' then play the project. It should now run.

In case the above fix does not work I have seen this myself where a tick box is not ticked for some reason so you should check they are ticked > In the Box example open properties for the Box project. In VC++ Directories where we were before. For each of the exe, incl and library directories click on the drop down and select edit. In this window you will see at the bottom a tick box with 'Inherit from parent or project defaults'. This should be ticked, so if the above steps aren't working check this is ticked for each of the three directories.

----------------

I created this guide from scratch as I was curious to see if a step had to be included which involves building an effects project and copy pasting files. I have seen now that many examples are working with the steps I have tried above only so maybe the effects procedure is not required (maybe its for the examples to work using VS15).

In case there is an example someone comes across that isn't working with the steps used above i'll include this other procedure (Only carry out these steps if the above does not work for you):

1) If you don't have download the directx sdk june 2010. https://www.microsoft.com/en-gb/download/details.aspx?id=6812 . You need to copy the effects11 folder found, on my computer it is in C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Effects11. IMPORTANT, COPY THIS AND PASTE SOMEWHERE ELSE. You do not want to change anything from it's original location.

2) So now you have the Effects11 folder copy and pasted somewhere else on your computer, location doesn't matter really can be anywhere you want to place it. Inside this folder, open the Solution for Effects11_2010. You need to run this in debug and release mode, at the end of each run a message will appear saying 'unable to start program' but this is fine.

3)Then after this has been done there will be a debug and release folder appear in the Effects11 folder. In the debug folder find the Effects11 object library file and rename it to Effects11d. In the release folder now find the Effects11 object library file, this does not need renaming.

4)Now both of these files the Effects11d that was renamed and the Effects11 just seen both need to be copied. They should then be pasted into the Common folder that the books examples come with. This common folder allows for the examples to work, that common folder. So both debug and release effect files paste them into the common folder. Last of all in the Effects11 main folder open it one more time. Open 'Inc' folder, copy 'd3dx11effect' header file. Then paste this into the common folder now.

----------------

That's pretty much it. Thank you gamedev.net for helping me getting this working. The community have been an invaluable help. Every person that gave me input in a thread i made a year ago that i worked at for awhile then stopped to work on other stuff. To the people that have helped me in this recent thread I made as I am now needing to use DirectX for something i'm making. Every bit of info i received got me that bit closer to making this books examples to run for me. Such a hassle they don't just run straight away but with newer operating systems and software and when the examples were actually created. It's probably understandable/expected for the examples to need tweaks. I want to give a big thank you to community members Infinisearch and Happy SDE who's help on this matter helped me get this working. They had both given massive input into making this work for me. Thanks guys but you know this already as I PM'd this to you both ;).

Ok, this is a long enough post as it needs to be. Better cut this post short now. Thanks again gamedev.net for allowing me to learn directx from that book now, as i have the examples working. 

edit - I have just realised that there are downloads for Source Code Set 2 and 3. I was only testing the examples from code set 1. I totally forgot that there were more examples. Only because i've been trying so long trying to get these first lot of examples running. Hopefully the other examples work fine but the examples for code set 1 definitely all run okay. I am going to see now what these other examples are like. I am keen to see what interesting things there are to see in these other code sets.

- The first example for code set 2 needs the effects11 procedure to occur before it can run fyi. I haven't tested anymore so far. The other examples are working fine (code set 2). I'm going to say that for code set 2, effects11 needs setting up.

- Tested near enough every example now, code set 3 including. They all run. from code set 2 the effects11 needs setting up then the examples are able to work.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Announcements

  • Forum Statistics

    • Total Topics
      628300
    • Total Posts
      2981898
  • Similar Content

    • By mister345
      Does buffer number matter in ID3D11DeviceContext::PSSetConstantBuffers()? I added 5 or six constant buffers to my framework, and later realized I had set the buffer number parameter to either 0 or 1 in all of them - but they still all worked! Curious why that is, and should they be set up to correspond to the number of constant buffers?
      Similarly, inside the buffer structs used to pass info into the hlsl shader, I added padding inside the c++ struct to make a struct containing a float3 be 16 bytes, but in the declaration of the same struct inside the hlsl shader file, it was missing the padding value - and it still worked! Do they need to be consistent or not? Thanks.
          struct CameraBufferType
          {
              XMFLOAT3 cameraPosition;
              float padding;
          };
    • By GreenGodDiary
      I'm attempting to implement some basic post-processing in my "engine" and the HLSL part of the Compute Shader and such I think I've understood, however I'm at a loss at how to actually get/use it's output for rendering to the screen.
      Assume I'm doing something to a UAV in my CS:
      RWTexture2D<float4> InputOutputMap : register(u0); I want that texture to essentially "be" the backbuffer.
       
      I'm pretty certain I'm doing something wrong when I create the views (what I think I'm doing is having the backbuffer be bound as render target aswell as UAV and then using it in my CS):
       
      DXGI_SWAP_CHAIN_DESC scd; ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC)); scd.BufferCount = 1; scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_UNORDERED_ACCESS; scd.OutputWindow = wndHandle; scd.SampleDesc.Count = 1; scd.Windowed = TRUE; HRESULT hr = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, NULL, NULL, NULL, D3D11_SDK_VERSION, &scd, &gSwapChain, &gDevice, NULL, &gDeviceContext); // get the address of the back buffer ID3D11Texture2D* pBackBuffer = nullptr; gSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); // use the back buffer address to create the render target gDevice->CreateRenderTargetView(pBackBuffer, NULL, &gBackbufferRTV); // set the render target as the back buffer CreateDepthStencilBuffer(); gDeviceContext->OMSetRenderTargets(1, &gBackbufferRTV, depthStencilView); //UAV for compute shader D3D11_UNORDERED_ACCESS_VIEW_DESC uavd; ZeroMemory(&uavd, sizeof(uavd)); uavd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; uavd.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D; uavd.Texture2D.MipSlice = 1; gDevice->CreateUnorderedAccessView(pBackBuffer, &uavd, &gUAV); pBackBuffer->Release();  
      After I render the scene, I dispatch like this:
      gDeviceContext->OMSetRenderTargets(0, NULL, NULL); m_vShaders["cs1"]->Bind(); gDeviceContext->CSSetUnorderedAccessViews(0, 1, &gUAV, 0); gDeviceContext->Dispatch(32, 24, 0); //hard coded ID3D11UnorderedAccessView* nullview = { nullptr }; gDeviceContext->CSSetUnorderedAccessViews(0, 1, &nullview, 0); gDeviceContext->OMSetRenderTargets(1, &gBackbufferRTV, depthStencilView); gSwapChain->Present(0, 0); Worth noting is the scene is rendered as usual, but I dont get any results from the CS (simple gaussian blur)
      I'm sure it's something fairly basic I'm doing wrong, perhaps my understanding of render targets / views / what have you is just completely wrong and my approach just makes no sense.

      If someone with more experience could point me in the right direction I would really appreciate it!

      On a side note, I'd really like to learn more about this kind of stuff. I can really see the potential of the CS aswell as rendering to textures and using them for whatever in the engine so I would love it if you know some good resources I can read about this!

      Thank you <3
       
      P.S I excluded the .hlsl since I cant imagine that being the issue, but if you think you need it to help me just ask

      P:P:S. As you can see this is my first post however I do have another account, but I can't log in with it because gamedev.net just keeps asking me to accept terms and then logs me out when I do over and over
    • By noodleBowl
      I was wondering if anyone could explain the depth buffer and the depth stencil state comparison function to me as I'm a little confused
      So I have set up a depth stencil state where the DepthFunc is set to D3D11_COMPARISON_LESS, but what am I actually comparing here? What is actually written to the buffer, the pixel that should show up in the front?
      I have these 2 quad faces, a Red Face and a Blue Face. The Blue Face is further away from the Viewer with a Z index value of -100.0f. Where the Red Face is close to the Viewer with a Z index value of 0.0f.
      When DepthFunc is set to D3D11_COMPARISON_LESS the Red Face shows up in front of the Blue Face like it should based on the Z index values. BUT if I change the DepthFunc to D3D11_COMPARISON_LESS_EQUAL the Blue Face shows in front of the Red Face. Which does not make sense to me, I would think that when the function is set to D3D11_COMPARISON_LESS_EQUAL the Red Face would still show up in front of the Blue Face as the Z index for the Red Face is still closer to the viewer
      Am I thinking of this comparison function all wrong?
      Vertex data just in case
      //Vertex date that make up the 2 faces Vertex verts[] = { //Red face Vertex(Vector4(0.0f, 0.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(100.0f, 100.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(100.0f, 0.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(0.0f, 0.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(0.0f, 100.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), Vertex(Vector4(100.0f, 100.0f, 0.0f), Color(1.0f, 0.0f, 0.0f)), //Blue face Vertex(Vector4(0.0f, 0.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(100.0f, 100.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(100.0f, 0.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(0.0f, 0.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(0.0f, 100.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), Vertex(Vector4(100.0f, 100.0f, -100.0f), Color(0.0f, 0.0f, 1.0f)), };  
    • By mellinoe
      Hi all,
      First time poster here, although I've been reading posts here for quite a while. This place has been invaluable for learning graphics programming -- thanks for a great resource!
      Right now, I'm working on a graphics abstraction layer for .NET which supports D3D11, Vulkan, and OpenGL at the moment. I have implemented most of my planned features already, and things are working well. Some remaining features that I am planning are Compute Shaders, and some flavor of read-write shader resources. At the moment, my shaders can just get simple read-only access to a uniform (or constant) buffer, a texture, or a sampler. Unfortunately, I'm having a tough time grasping the distinctions between all of the different kinds of read-write resources that are available. In D3D alone, there seem to be 5 or 6 different kinds of resources with similar but different characteristics. On top of that, I get the impression that some of them are more or less "obsoleted" by the newer kinds, and don't have much of a place in modern code. There seem to be a few pivots:
      The data source/destination (buffer or texture) Read-write or read-only Structured or unstructured (?) Ordered vs unordered (?) These are just my observations based on a lot of MSDN and OpenGL doc reading. For my library, I'm not interested in exposing every possibility to the user -- just trying to find a good "middle-ground" that can be represented cleanly across API's which is good enough for common scenarios.
      Can anyone give a sort of "overview" of the different options, and perhaps compare/contrast the concepts between Direct3D, OpenGL, and Vulkan? I'd also be very interested in hearing how other folks have abstracted these concepts in their libraries.
    • By aejt
      I recently started getting into graphics programming (2nd try, first try was many years ago) and I'm working on a 3d rendering engine which I hope to be able to make a 3D game with sooner or later. I have plenty of C++ experience, but not a lot when it comes to graphics, and while it's definitely going much better this time, I'm having trouble figuring out how assets are usually handled by engines.
      I'm not having trouble with handling the GPU resources, but more so with how the resources should be defined and used in the system (materials, models, etc).
      This is my plan now, I've implemented most of it except for the XML parts and factories and those are the ones I'm not sure of at all:
      I have these classes:
      For GPU resources:
      Geometry: holds and manages everything needed to render a geometry: VAO, VBO, EBO. Texture: holds and manages a texture which is loaded into the GPU. Shader: holds and manages a shader which is loaded into the GPU. For assets relying on GPU resources:
      Material: holds a shader resource, multiple texture resources, as well as uniform settings. Mesh: holds a geometry and a material. Model: holds multiple meshes, possibly in a tree structure to more easily support skinning later on? For handling GPU resources:
      ResourceCache<T>: T can be any resource loaded into the GPU. It owns these resources and only hands out handles to them on request (currently string identifiers are used when requesting handles, but all resources are stored in a vector and each handle only contains resource's index in that vector) Resource<T>: The handles given out from ResourceCache. The handles are reference counted and to get the underlying resource you simply deference like with pointers (*handle).  
      And my plan is to define everything into these XML documents to abstract away files:
      Resources.xml for ref-counted GPU resources (geometry, shaders, textures) Resources are assigned names/ids and resource files, and possibly some attributes (what vertex attributes does this geometry have? what vertex attributes does this shader expect? what uniforms does this shader use? and so on) Are reference counted using ResourceCache<T> Assets.xml for assets using the GPU resources (materials, meshes, models) Assets are not reference counted, but they hold handles to ref-counted resources. References the resources defined in Resources.xml by names/ids. The XMLs are loaded into some structure in memory which is then used for loading the resources/assets using factory classes:
      Factory classes for resources:
      For example, a texture factory could contain the texture definitions from the XML containing data about textures in the game, as well as a cache containing all loaded textures. This means it has mappings from each name/id to a file and when asked to load a texture with a name/id, it can look up its path and use a "BinaryLoader" to either load the file and create the resource directly, or asynchronously load the file's data into a queue which then can be read from later to create the resources synchronously in the GL context. These factories only return handles.
      Factory classes for assets:
      Much like for resources, these classes contain the definitions for the assets they can load. For example, with the definition the MaterialFactory will know which shader, textures and possibly uniform a certain material has, and with the help of TextureFactory and ShaderFactory, it can retrieve handles to the resources it needs (Shader + Textures), setup itself from XML data (uniform values), and return a created instance of requested material. These factories return actual instances, not handles (but the instances contain handles).
       
       
      Is this a good or commonly used approach? Is this going to bite me in the ass later on? Are there other more preferable approaches? Is this outside of the scope of a 3d renderer and should be on the engine side? I'd love to receive and kind of advice or suggestions!
      Thanks!
  • Popular Now