Duplicate Mesh

Started by
2 comments, last by dani333 19 years, 10 months ago
hi, I have mesh ( piece of ground) that i created , i need to uplicate it few times to different locations. For example i have ground 512X512 , starting point (0,0,0) end point (512,0,512), i need another 512X512 piece in location: starting point (100,0,100) end point (1024,0,1024) what shell i do? I also want to translate a chosen piece to another location how do i do that? Thanks:-)
Advertisement
You need, to post what language you use (usually taken as c/c++), what gfx api you are using, and in what format are you storing your mesh (ie is it a d3dxmesh or a vb or a user buffer).

If you want the same strip translated, just make a translation matrix. If you want to have additional meshes, but of the same phyiscal structure, just copy and append them to your buffer, or add them to a new buffer then just modify the required vertex components.

If you are trying to make a game but do not understand the basics of the api and language I suggest that you scrap it and instead focus on learning the basics.

[edit]: you don't need 10 carriage returns at the end of your post either

[edited by - SoulSpectre on June 2, 2004 4:03:45 AM]
Yes, I probably wasn''t clear enough, sorry for that.
Anyways, what I mean is, say, I have a model, somewhere on my screen, now, I want to duplicate it in another location. The model looks the same, moves the same, has the same polygons, only translated. The question is, can I duplicate it, to another location, without allocating and implementing a new geometry...Some kind of projection, or something. Now, this is not language dependant, but I use C++/OGL, without GLUT or other extentions.
Thanks in advance.
All you have to do is call glTranslatef before drawing the model, and use glPushMatrix( ) and glPopMatrix( ) to save and load the previous matrix state e.g.:

//draw model hereglPushMatrix( )   glTranslatef(100, 0, 100)   //draw model hereglPopMatrix( )  


Would draw one model at the origin and another at (100, 0, 100) and remember that in GL the negative Z axis goes into your screen so a model at (100, 0, 100) would be behind you unless you use a camera transform to move the scene around.

This topic is closed to new replies.

Advertisement