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

I have to learn DirectX for a course I am studying. This book https://www.amazon.co.uk/Introduction-3D-Game-Programming-Directx/dp/1936420228 I felt would be great for me to learn from.

The trouble is the examples which are all offered here http://www.d3dcoder.net/d3d11.htm . They do not work for me. This is a known issue as there is a link on the examples page saying how to fix it. I'm having difficulty with doing this though. This is the page with the solution http://www.d3dcoder.net/Data/Book4/d3d11Win10.htm.

The reason why this problem is happening, the book was released before Windows 10 was released. Now when the examples are run they need slight fixes in order for them to even work. I just can't get these examples working at all.

Would anyone be able to help me get the examples working please. I am running Windows 10 also just to make this clear, so this is why the examples are experiencing the not so desired behaviour. I just wish they would work straight away but there seems to be issues with the examples from this book mainly because of it trying to run from a Windows 10 OS.

On top of this, if anyone has any suggestions with how I can learn DirectX 11 i would be most grateful. Thanks very much. I really would like to get them examples working to though from the book I mentioned.

Look forward to reading any replies this thread receives.

 

GameDevCoder.


PS - If anyone has noticed. I asked this about 1 year ago also but this was when I was dabbling in it. Now I am actually needing to produce some stuff with DirectX so I have to get my head round this now. I felt at the time that I sort of understood what was being written to me in response to my thread back then. I had always been a little unsure though of being absolutely sure of what was happening with these troublesome examples. So I am really just trying to get to the bottom of this now. If anyone can help me work these examples out so I can see them working then hopefully I can learn DirectX 11 from them.

 

*SOLUTION* - I was able to get the examples running thanks to the gamedev.net community. Great work guys. I'm so please now that I can learn from this book now I have the examples running.

https://www.gamedev.net/forums/topic/693437-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/?do=findComment&comment=5363013

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

Thanks for the reply. So, In order to getting these examples to work there needs to be some tweaks so they run normally again.

From stuff in a topic I made about the same thing last year actually as I was just looking into this (preparation work) just then but am now needing to actually use DirectX so am really trying to get these examples working fine now.

I have tried using some knowledge of which I acquired when I made a similar topic about a year ago now. Last night I was able to get working examples for chapter 1, 2, there isn't any for 3, chapter 4. One of the four examples in Chapter 6 I have working now to. If I can talk about an issue I'm having with one example for chapter 6.

Here is what is stopping me run the Box example for chapter 6 right now. https://ibb.co/mQbPvw

Prior to this like I have done similarly with the examples before to get them working for me:

-Clicking in properties I go on VC++ Directories and change the include and library directories to include $(DXSDK_DIR), or where a 'common' folder is located that all the examples rely on.

- In Linker - Input. I remove d3dx11d.lib (in debug config), d3dx11.lib (in release), dxerr.lib (for both).

- Lastly I right click on the project and add existing item - I select from common folder 'dxerr.h and dxerr.cpp.

 

These steps allow for some examples to work. I'm having a problem with this box example though now and am not sure what to do.

Lastly, in some cases I might reconfigure so the common folder can be found like in c/c++ property page include directory. In the end I just try many ways in the hope I can get the examples working, I was given some instructions in the past how to get them working although I wasn't so confident that they worked flawlessly (i mean, it worked for one example but I wasn't sure they would work for other examples) or that I understood properly how they worked.

 I hope this helps with explaining my predicament a bit more. 

 

Any help would be so very much appreciated from the community. Thank you.

Share this post


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

On top of this, if anyone has any suggestions with how I can learn DirectX 11 i would be most grateful.

I dont know anything about that book, but you can learn dx11 directly from MSDN and their dx11 samples work on windows 10 (I just checked them)

 

Direct3D Tutorial Win32 Sample - https://code.msdn.microsoft.com/Direct3D-Tutorial-Win32-829979ef
This is the classic tutorials 1-7 that take you from setting up a window to displaying a rotating textured cube. The download button is at the top of that page.
The zip file contains:
1. description.html
  this has links for all 7 tutorial step by step descriptions. You should read all of these

2. A folder called c++
You can open this "Tutorials.sln" solution in visual studio (I use visual studio 2017), and let it update them all to the latest version of visual studio. Or you can open the projects in the folders which seems to also open all of them.
The sample contains all 7 tutorials. Compile them.
To run a particular sample (as the solution contains all), in the solution explorer of visual studio right click on the one you want eg "Tutorial07" and select "set as startup project". Then from the top menu select debug - start debugging.
I just checked it and it does work on windows 10, with visual studio 2017

********
After these 7 tutorials I recommend MSDN:

Direct3D 11 Graphics - https://msdn.microsoft.com/en-us/library/windows/desktop/ff476080(v=vs.85).aspx
Read each of those sections links

HLSL - https://msdn.microsoft.com/en-us/library/windows/desktop/bb509561(v=vs.85).aspx
Read each of those sections links

 

Edited by CortexDragon

Share this post


Link to post
Share on other sites

I think you need to download and install the legacy june 2010 directx SDK, because the bewerkt SDK's dont include d3dx11, which is used in luna's book and examples. You can find it on github, might need to build the libs (debug and release) yourself. Which should be relatively easy with some googling (if you've never did this before).

Share this post


Link to post
Share on other sites
16 minutes ago, cozzie said:

I think you need to download and install the legacy june 2010 directx SDK, because the bewerkt SDK's dont include d3dx11, which is used in luna's book and examples. You can find it on github, might need to build the libs (debug and release) yourself. Which should be relatively easy with some googling (if you've never did this before).

Hi. thank you. Yeah, I have installed the june 2010 directx sdk. I have had to do things with the debug and release also like removing some libraries that someone mentioned to me in the past. I appreciate your post.
If anyone can see the issue I'm having at the moment with the BOX example that isn't working. If anyone knows how them errors can be fixed? It was in regards to this https://ibb.co/mQbPvw  . Thanks forum.

Share this post


Link to post
Share on other sites
1 minute ago, Infinisearch said:

If you install and use the june 2010 SDK then you won't need to change anything.

Interesting. I am just working through these examples now as it goes. Will see how I get on. Thanks for these post. Food for thought. 

Share this post


Link to post
Share on other sites

Not overly familiar with DirectXMath, and it has been quite a while since I was digging through the Luna DX11 book, but it looks like you probably need to use the constructor for XMFLOAT4, rather than rely on an implicit conversion

https://msdn.microsoft.com/en-us/library/windows/desktop/ee419645(v=vs.85).aspx

Share this post


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

Ok. I have removed a couple errors and am just left with one issue for the BOX example in chapter 6.

Does anyone know how I can fix this please?  https://ibb.co/gstKvw

I've no idea what to do about this problem.

Put the code back to its original state.  It was not trying to use a pointer to a color.  You can't use pointer as vertex data.

Share this post


Link to post
Share on other sites

 

11 hours ago, Infinisearch said:

Put the code back to its original state.  It was not trying to use a pointer to a color.  You can't use pointer as vertex data.

Thanks for the post. I haven't altered the original code in anyway. I have only tinkered with the project settings/properties. Any chance you can elaborate on for me please? If you might know how I can solve this issue?

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

My mistake, I thought you had been messing around with the code and assumed.  Follow what ericrrichards22 mentions.  Basically this is to just manually stick some xmfloat4's in there with what ever values you find for RGBA whereever "Colors::" is defined.

edit - you can also use Colors:: in the same way.... sorry I edited my post and made it confusing.

Edited by Infinisearch

Share this post


Link to post
Share on other sites
2 hours ago, Infinisearch said:

My mistake, I thought you had been messing around with the code and assumed.  Follow what ericrrichards22 mentions.  Basically this is to just manually stick some xmfloat4's in there with what ever values you find for RGBA whereever "Colors::" is defined.

edit - you can also use Colors:: in the same way.... sorry I edited my post and made it confusing.

;) it's ok. Thanks for the post Infinsearch. I will be trying out some stuff with getting these examples to work over the weekend I plan too. Will see if I can get this BOX example working.

Share this post


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

2015 i'm using

Then I take back what I said about not having to change anything.

See here: https://blogs.msdn.microsoft.com/chuckw/2012/04/24/wheres-dxerr-lib/

IIRC If you want to make things real easy just use VS2013 and the 2010 SDK.  It will get you up and running with the demo's from the book... and once you feel comfortable with the basics you can either move past using the legacy libraries or use their replacements.

On 11/9/2017 at 10:46 PM, ericrrichards22 said:

Not overly familiar with DirectXMath, and it has been quite a while since I was digging through the Luna DX11 book, but it looks like you probably need to use the constructor for XMFLOAT4, rather than rely on an implicit conversion

https://msdn.microsoft.com/en-us/library/windows/desktop/ee419645(v=vs.85).aspx

This really should work for you in your older version.  You should try it.

Share this post


Link to post
Share on other sites

Before I carry on. I just want to say how I over came this issue https://ibb.co/gstKvw .

Like people suggested it was regarding the constructor. So like this https://ibb.co/f0vXHb that part of the code is now working. It's just https://ibb.co/hG0gSb being my last hurdle now. 

 

I will download VS13 and give that a shot. Thanks for this suggestion. I totally agree with what you say to that if this goes well I can then become familiar with it all then later I can move onto using VS15 for DirectX when I have built up my confidence more from learning it.

 

PS - it's a bit annoying to really as I was able to remove this error in one version of me trying to get the example to work. It has appeared again though this error and now I'm not sure how to remove it. I will start downloading VS13 also now.

Edit - Finding it hard to download VS13. Where I should be able to get it, this page won't let me download it. Where I scroll down to the download I need something to load and it just isn't loading. It's like they aren't fussed with older content being viewed by anyone now.

Edit 2- I can download the express version I think, I was trying to download the community version. I'll try the express version and see how it goes.... I think getting VS13 is going to be a struggle too. I've tried doing this and I'm just getting webpages thrown at me saying error and to get in touch with Microsoft. I had this pop up on my screen when I tried downloading VS13 express "We are sorry, but our system is detecting a problem with your account and we are unable to validate access to your subscription". Such a pain in the backside to get anything done :l . I just tried going on live chat with support but they only open Mon-Fri :(.

I'll see if I can download VS13 still otherwise I'll have to try and get it working using VS15 that I am currently using.

I've emailed the support team also now to see why I can't download VS13. Hopefully they show me a fix for this.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

I know you want to stick with Luna but just so you know there are some tutorials here:

http://www.rastertek.com/tutdx11s2.html

Oh and why did you delete the older version you were working on?

edit - BTW on the front page of d3dcoder.net is frank luna's email address.

Edited by Infinisearch

Share this post


Link to post
Share on other sites

I have to pop out right now so can't reply properly. I will write a full response in a number of hours. May be sometime as am about to work a shift then it will be almost sleep time. Thanks for the post, I will reply later when I have the time to.

Share this post


Link to post
Share on other sites

Just so you know I took some time and tried this out myself on VS2013.  It worked.

This is what I did to setup the project to with the June 2010 SDK:

https://digitalerr0r.wordpress.com/2014/05/02/setting-up-a-directx-11-project-in-visual-studio-2013-and-visual-studio-2012/

Then I built the effects library in VS2013, on my computer it is found in C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Effects11

edit - Section 6.8 in the book tells you to do this.

After I compiled it in debug and release mode I copied (you might have to rename the files according to the section in the book titled effects) them to the common directory of the downloaded source file.  I also copied the header file from the \inc subdirectory of the above directory to the common directory of the downloaded source file.

eg something like - C:\book3dluna\DVD\Code\Common

where the box project would be located in C:\book3dluna\DVD\Code\Chapter 6 Drawing in Direct3D\Box

You should be able to compile from there, (I might have left out one step, but you should be able to figure it out) Good Luck.

edit - VS2013 can be downloaded here:

https://www.visualstudio.com/vs/older-downloads/

edit2 - I compiled a few other projects from that chapter and they all worked.  Then I skipped ahead to Chapter 25 and that compiled and ran as well.  So the above technique should work for all examples in the book.

Edited by Infinisearch

Share this post


Link to post
Share on other sites

I just checked out your first thread on this topic... there was a solution in it and you said it worked.  In fact its basically what I posted above.  Why did you open a new thread?  I kinda feel like I've been robbed of an hour or so of my life.

Share this post


Link to post
Share on other sites

Hi. Just got in from a shift. I have had a couple of private messages to which I will have to read after I write this.

Thanks for your posts. Should help me greatly.

I did mention stuff in my first few messages, sorry if you overlooked them but I did say. Also, the point I tried to make was that although I did have some help with this already in the past. I did not quite feel like I was equipped to have this work for all the examples. As I feel some examples can work by doing somethings. But other examples might need a little extra something being done too. As examples can be different to one another as you might expect.

I was just after if anyone was kind enough to offer any assistance with me trying to get these examples working. I appreciate all the posts that this thread has received so far. I am sorry though Infinisearch if you feel like I have costed you some of your time. Apologese, I am just in such a bind with this. Just wishing these examples would work and as this topic shows. I am still having trouble getting them working. Hence me asking if anyone from gamedev.net would be able to offer any tips. I really do appreciate your last post. I will certainly be using it and following as much as I am able to, hopefully I can carry out every bit. It will be using VS15 as I cant download VS13 for some reason, that site is just not letting me saying something like I cant download it for some reason or another (an error message). I have sent the support team a query saying i want to download VS13 and how I can so I will see what they say too. Apparently they are only around Mon-Friday. Thanks for the post again. I shall follow what you carried out and see how it goes for me.

Edited by GameDevCoder

Share this post


Link to post
Share on other sites

No need for an apology.  It just that a solution appears to be in that thread since you yourself said it worked... why not just try that again?  If you wanted to know exactly what it is that you were doing thats a different question.  But anyway just so you know the Luna book's code builds on each previous chapter and seeing as how I tested the last chapter too, they all should work.

In case that link goes dead I'll post whats in it here:

Setting up a Visual Studio project to use the DirectX SDK

Right click on the project and select properties.  Choose the VC++ directories page under Configuration properties.  Under the configuration dropdown select All Configurations.  Add the following entries under their appropriate section.

executable: $(DXSDK_DIR)Utilities\bin\x86
Include: $(DXSDK_DIR)Include
Library: $(DXSDK_DIR)Lib\x86

 

edit - Oh and to get the Luna samples up and running on VS2015 using the DXSDK you need to follow the link I put in an above post about dxerr.lib... there's a file there you need to download and compile.

Edited by Infinisearch

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


  • Forum Statistics

    • Total Topics
      628278
    • Total Posts
      2981785
  • Similar Content

    • 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!
    • By deltaKshatriya
      Hey all,
      As some of you may know, I do have a Computer Science background, but either by chance/design/fate/insert stupid excuse here, I didn't take any graphics courses in my undergraduate degree, but now I'd be very interested in at least learning the basics of graphics and potentially pursuing more in graphics. I'm interested in all sorts of graphics in general, so everything from real-time engines to rendering engines like Arnold, Octane, etc. Can anyone point me in the right directions for books/tutorials?
      Thanks in advance!
      EDIT: Apologies in advance if I missed the proper channels for this as well
    • By ConsolaLarry
      After my first thread and some painful deleting AND some lengthy drive resizing, I now have Unity and Visual Studio Enterprise
      As the hype of me finally being able to make a game that I've always dreamed of faded away because of school schedule being a douchebag, I came to a painful realization that I basically don't know anything about Unity (making progress at least, with the tutorial, the rest....well....I don't have a credit card yet, and my age is 2^4 + 1 (don't wanna be too....public)) nor C# (hopefully dotnetcademy.net's C# course for complete beginners can somehow help me with this).
      At least I know what I am doing (I guess) with my game: 2D, Top down, Isometric, Pixel Art (because I'm on my own and I can't draw like an artist and I'm too broke), RPG with EXP, Class Advancement system and probably some sort of a seeding mechanism for randomized gameplay
      So, as a complete greenhorn stepping into the field with a completely wrong set of equipments, I'd love some advices from the pros and the experienced (all advices are welcomed OwO)/ ), esp to these questions:
      - Should I take on regular C# and then learn Unity C# or skip regular C# and straight to Unity C#?
      - Is pixel art really a way out for me on the visual part? Sprites, maps, items, effects, etc......
      - Is my idea okay? Is there anything I can add in or cross out?
      - Should I do this alone? Or should I get some accomplices? I'm not planning to rush it anyway.
       
      Thank you in advance. Sorry, no potato this time
  • Popular Now