Windows 8 Direct3D Getting Started Help -- Two Cubes

Started by
3 comments, last by mBird 11 years, 8 months ago
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!!!
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.
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
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.
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!

This topic is closed to new replies.

Advertisement