Sign in to follow this  
SumDude

DirectX Questions (Devices, Transformations)

Recommended Posts

For every shape or something that i want to draw would i have to create a device for it? Plz don't flame me for this because i just recently got into Direct3D and i am confused on how you would transform shapes different ways without creating multiple Devices. If you want to rotate one shape but have another shape translate to a different area is it really necessary to make a new device??? Sorry if this is a bit of a dumb question.

Share this post


Link to post
Share on other sites
No. Very, very few programs have more than one device.

APIs such as DirectX and OpenGL draw according to the current rendering state. They don't remember what they've drawn, except to keep the picture it around. So if you want to draw one apple at (0, 0) and another apple at (5,1), draw the first apple, set a new model transformation, and draw another apple.

Share this post


Link to post
Share on other sites
You could look at the DirectX tutorials that come with the sdk. Tutorial 3 Using Matrices shows what you want :)

The world matrix translates/rotates/scales an object so just set the world matrix for every object.

D3DXMATRIX matWorld;
D3DXMatrixRotationY( &matWorld, timeGetTime()/150.0f );
g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );

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

Sign in to follow this