Need help stopping and redrawing a object..

I have a question regarding what seems to be a simple function but i cant seem to get it to work, I am using NeHe’s Windows framework(the framework is not all that important) and I am hoping that someone could help me accomplish the following:
-> I have an object that I would like to move along the z-axis to a certain point the stop it from moving (once at this point I want to “erase” this object and start to draw a new one from the beginning point and have it travel to a point and erase…then redraw a new object (a simple loop)) also if possible where in NeHe’s (http://nehe.gamedev.net/opengl.asp) framework would this be placed, I have tried a number of different places but none seem to work. If someone could help me with this it would be a huge help! I am trying to learn this on my own and running into a few hurdles.

thanks for your time.

The last reply got eaten, so here I go again.

If you wish to have an object move out from the center and start over at the center, try this-

sub main()
x=0:y=0
for numLoops=1 to 100
for z=0 to 100
call drawObject(x,y,z)
next z
next numLoops
end sub

sub drawObject(x,y,z)
glClear(GL_DEPTH_BUFFER_BIT,GL_COLOR_BUFFER_BIT)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity
glTranslatef(x,y,z)
*** Draw your object ***
glFlush()
SwapBuffers(hdc) ’ Only if you are using back buffer
end sub

This is not pretty, but it gets the job done. It draws a single object and moves it along the Z axis, then starts it back at the center. This is for one object. If you have more than one object or multiple objects, then you will need to keep track of them seperately.

This needs to be placed after all of your OpenGL window setup. After you have created a rendering context. But before you do any OpenGL shutdown functions. You will probably want to place the Main() code somewhere in your Main function after all of the Init code. The drawObject could be placed anywhere.

The code above is in VB, but should be simple enough to convert to any language. :stuck_out_tongue:

Thanks I will give that a try tomorrow. Once again thanks for the help!