Jump to content

  • Log In with Google      Sign In   
  • Create Account


Windows 8 Direct3D Getting Started Help -- Two Cubes


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 mBird   Members   -  Reputation: 115

Like
0Likes
Like

Posted 28 July 2012 - 08:06 AM

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

Sponsor:

#2 SamiHuutoniemi   Members   -  Reputation: 259

Like
0Likes
Like

Posted 28 July 2012 - 08:29 AM

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.

#3 mBird   Members   -  Reputation: 115

Like
0Likes
Like

Posted 28 July 2012 - 08:46 AM

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, 28 July 2012 - 08:48 AM.


#4 TiagoCosta   Crossbones+   -  Reputation: 2045

Like
1Likes
Like

Posted 28 July 2012 - 09:15 AM

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, 28 July 2012 - 09:16 AM.


#5 mBird   Members   -  Reputation: 115

Like
0Likes
Like

Posted 28 July 2012 - 09:38 AM

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, 28 July 2012 - 01:40 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS