Jump to content
  • Advertisement
Sign in to follow this  
mBird

Windows 8 Direct3D Getting Started Help -- Two Cubes

This topic is 2185 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 --

I am trying to explore/learn Direct3D for Windows 8 Metro. When you create a new Direct3D project in Visual Studio 2012 RC you get a template and it has a single rotating cube. I am using that along with online docs to learn.

CubeRenderer.cpp:
To take the next step it would be great to have a sample that adds a second cube and has it rotate around that first one. That would make a nice basic sample/tutorial that could really help answer some basic questions (none of MS tutorials for Metro have more than one object in the scene).

I have tried to do it myself but I am missing something :(
(and looking at previous versions of Direct3D I can't make teh leap to how it is done here in Metro)

Would anyone be able to send code snip or pseudo-code as to how to add another cube to that existing code -- how to add objects to that scene. So just the basic scene with two cubes (or sphere or any 3D object) would be plenty!

Thank you!!!

Share this post


Link to post
Share on other sites
Advertisement
I think the best way to go on for you, is to first understand how the code generates that one cube. I would make my own "engine" by first learning how to open a window. Then how to initialize directx, then to add a cube, and so on. This way you learn, and you get a usable framework for your future project.

Share this post


Link to post
Share on other sites
Hi --

That's the thing... getting a single cube up is no problem and I have a single rotating cube at the momement. But I don't understand how to add another cube?

I create my cubes vertices and indeces in CubeRenderer::CreateDeviceResources().

I see how to do the single cube in CubeRenderer::Render() but I don't see how to integrate the second cube that I made in CubeRenderer::CreateDeviceResources().

If I had that as a sample (i.e two cubes) it would be a great launching point to then go back and learn the individual pieces.

Thank you!

p.s. please note this is for Metro Windows 8 Direct3D in VS 2012RC Edited by mBird

Share this post


Link to post
Share on other sites
I'm sure there are some lines of code that set the world matrix of the cube and make the draw call.
To draw a second cube, set a different world matrix after the first cube draw call and then execute the draw call again.

Check the Tutorial 5 from DirectX 11 SDK. Edited by TiagoCosta

Share this post


Link to post
Share on other sites
Hi --

I found my mistake and got it working. Thanks for your time and help.

Yes Tutorial 5 was very helpful!
Windows 8 has no SDK so the samples/tutorials are not as good but from your post I realize I can use the older DirectX 11 SDK as a learning/sample point! Edited by mBird

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!