Jump to content
  • Advertisement
MarcusAseth

some D3D11 beginner questions

This topic is 436 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I've randomly found this place trough google and this is my first post, I don't know if my beginner level is still too low even for the beginners sections therefore if it is, my first question would be to point me in the right place where I should ask my questions :)

And if is ok, then this is my next question:

I'm going trough the book "3d Game Programming with DirectX 11" and in the process of creating a swapChain I'm staring at this code below

IDXGIDevice* dxgiDevice = 0;
HR(md3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice));

IDXGIAdapter* dxgiAdapter = 0;
HR(dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void**))&dxgiAdapter));

IDXGIFactory* dxgiFactory = 0;
HR(dxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**))&dxgiFactory));

IDXGISwapChain* mSwapChain;
HR(dxgiFactory->CreateSwapChain(md3dDevice, )&sd, )&mSwapChain));

 

From my understanding, in order to create a swapChain we need to use the same Factory used to create our Device otherwise for some reason everything explodes, therefore the call to QueryInterface() and the two calls to GetParent() are meant to give me back a pointer to said Factory.

Question 1): Now I'm watching msdn and a IDXGIDevice has a GetAdapter() method in it, so I was wondering, using it would achieve the same as the line

"dxgiDevice->GetParent(__uuidof(IDXGIAdapter),(void**))&dxgiAdapter));" or is a completely different thing?!

Question2): Not much further in the book, the writer do this "mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&backBuffer));"  so now we're using a reinterpret_cast and not "(void**)". Why this change? I am not very familiar with the different types of cast, so I can't tell the difference or the reason behind it x_x

Also can you recomend me let's say a youtube video or some reading that properly illustrates the structure of Direct3D? Because I am kind of confuse about what is going on here, the whole hierarchy of this thing and basically I don't have a clear picture of how all the pieces fit togeter... :/ 

Thanks :)

Edited by MarcusAseth

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!