tag when post any code, it helps a lot.
All you need is play with [glTranslate](http://www.opengl.org/sdk/docs/man/xhtml/glTranslate.xml)
Keep the actual translation position into a variable and with that one as an argument to [b]glTranslate[/b] function.
i tried it dis way…bt its not working…
for(int i=0;i<30;i++)
{
glTranslatef(i,0,0);
glBegin(GL_POLYGON);
glColor3f(1.0,0.0,0.0);
glVertex2f(10,10);
glColor3f(0.0f,1.0f,0.0f);
glVertex2f(40,10);
glColor3f(0.0,0.0,1.0);
glVertex2f(25,30);
You’re assuming that the scene will be redrawn each time through your loop. That’s not how GL works. What would happen with this code is that the loop would run all the way through, then the scene would be drawn with i = 29. Your program has to be restructured a bit to do animation. See NeHe Tutorial #4 and read about GlutIdleFunc.
Remember, every call to display func will be rendered on screen. The for that you have will execute 30 times and only then the result will be available.