#### Archived

This topic is now archived and is closed to further replies.

# Multiple Copies of One Object

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

## Recommended Posts

Ok, i know this is gunna sound corney, but how do i take one structure, like CQVPyramid that defines a pyramid in model space, and make multiple copies in different locations? im thinking something like:
//psuedo code

g_pDevice->SetTranslationMatrix(...)
DrawFirstPyramid(...)
g_pDevice->SetSecondTranslationMatrix(...)
DrawSecondPyramid(...)

in the Init function. I tried this, but it came up with an error. Is this the right way and i just need to fiddle with it, or is there some other *magical* way that im not getting? Quantum

##### Share on other sites
Not in the init function...in the render function. Same object -- draw it twice.

##### Share on other sites
And just for reference, I believe you would want to set the World matrix (and DirectX supplies up to 256 of those, I believe, through the use of it''s D3DTS_WORLD() macro [<- check me on that macro, it''s in the SDK docs])

Chris Pergrossi
My Realm | "Good Morning, Dave"

##### Share on other sites
Yay! Thanks. I tried to start the scene once in initialization, set the matrix, render, and then in the real render function do the same thing, becuase i thaught it would keep the position once it had been performed. My only thing, isnt it costly when i have scenes of 20+ objects, to change the matrix each time? or is it only changing the View Matrix that is costly? Oh, and does anyone know of a good Index Buffer Tutorial? In this project, im sorta just adding on stuff as i learn it... (bad in practice, but hey, it works for now) Ill post a snap shot of my game so far in the Your Announcement forum once i figure out how...

Quantum

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633679
• Total Posts
3013295
×