c++ - How can I implement a moving scene -
i implement moving scene in opengl.
scene description: terrain static other objects moving towards -x axis.
terrain plane in xz plane.
i have mesh appear lot of times on terrain in several places. of them moving towards -x axis @ specific speed.
i've thought of these possible implementations:
create 1 mesh , display several times (i prefer one) create several meshes, save them vector , move them. after leave viewport, maybe destroy them?the problem 1st way, i'll create meshes x% possibility, entails not knowing number of meshes needed. how can display them?
in illustration if knew create 3 meshes this:
glpushmatrix(); gltranslatef(mesh1 position + speed) mesh.dray(); glpopmatrix(); glpushmatrix(); gltranslatef(mesh2 position + speed) mesh.dray(); glpopmatrix(); glpushmatrix(); gltranslatef(mesh3 position + speed) mesh.dray(); glpopmatrix();
now in case need create meshes long animation continues, how implement that? , secondly, meshes left viewport? go on exist?
this reply useless if intend code in pure opengl.
however, if willing seek 3rd party library, seek www.ogre3d.org - find easy in ogre.
in fact challenges on 'intermediate tutorial one', if remember correctly, should address equivalent ogre concept of problem having opengl.
http://www.ogre3d.org/tikiwiki/tiki-index.php?page=intermediate+tutorial+1&structure=tutorials
(would've made comment, became active!)
c++ opengl
No comments:
Post a Comment