   Beginner help with opengl simple motion issues
  Hello everyone,I have no idea what to do. motion in my simple display is very strange. I just have some moving blocks. For some reason, they caterpillar instead of smooth motion. I do want them to move at a much slower rate (.11 cm per second). its like everything is not getting updated at the same time. Here is some of my code:float windowx = 1024;float windowy = 768;//physical size of the screenfloat pdisplayw = 38;void drawscene(void){glClear(GL_COLOR_BUFFER_BIT);glColor3f(1, 0,0);glPushMatrix();glTranslatef(move,0,0);glRectf(0,0,2,2);move +=.00031;glPopMatrix();glutSwapBuffers();glutPostRedisplay();;}void reshape(int w, int h){glViewport (0,0,(GLsizei)w,(GLsizei)h);glMatrixMode(GL_PROJECTION);glLoadIdentity();gluOrtho2D(-pdisplayw/2, pdisplayw/2, -pdisplayw/2*windowy/windowx, pdisplayw/2*windowy/windowx); }int main(int argc, char** argv){glutInit(&argc, argv);glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);glutInitWindowSize (windowx, windowy);glutInitWindowPosition (100, 100);glutCreateWindow (argv[0]);glutDisplayFunc(drawscene);glutReshapeFunc(reshape);glutMouseFunc(userinput);glutMainLoop();return 0;   
  From your code, you update "move" with the frame rate of your display, it's a very bad idea. Instead you should update the variable with the elapsed time. Ask Google for examples.   ;  Thank you for your reply. I had a timer but in trouble shooting it was removed. I can't seem to get the thing to move smoothly at lower speeds.....   ;  When using GLUT, I have usually seen this setup like this:void idle(){    // Remove these from drawscene()    move +=.00031;    glutPostRedisplay();}int main(int argc, char** argv){    // ...    glutIdleFunc(idle);   // <- Added    glutMainLoop();    return 0;}I'n not sure it will make a difference, but it's worth a shot.EDIT: Fixed a small bug.[Edited by - Gage64 on September 22, 2010 12:16:53 PM];  Thank you for your reply! I have tried your suggestion and it is still caterpillaring. :( Very good try. I have heard that you want to separate postredisplay and buffer swap.  I just can't seem to put my finger on it. Its like a wave (of update) from right to left. weird!   ;  Take a look here.   ;  Thank you for your reply!! that was a very good article to read. I had a timer once. And used that same method and equation. I have sense taken the timer out. For some reason i do not get smooth movement. and when i do get movement its like a ticking. when it moves there is a tracing or caterpillaring. I have a 3.0 quad core with 8 gb of ram. I don't think its hardware. I think the man question here is the speed. Its extremely slow speed. I think its ticking because of that.....is there smooth movement in opengl?   ;  Maybe I'm misunderstanding... but. Does it move smoothly when you have a higher speed? If you are moving at .11cm/sec and that distance is less than one pixel in screen space, than you will not see much, if any, change in the image each frame. And when you do see changes, your non-integral motions mean the changes don't have to line up with the pixels on the screen. Resulting in lines that kinda crawl. What I'm talking about is easy to see in commercial games if you can find a not-quite vertical polygon edge, and slowly move in relation to it. It will look like the edge of the line is crawling upwards/downwards depending on the slight slant. Is that what you're seeing? You could probably fix that, since you are in ortho mode, by using glTranslatef( float(int(move)),0,0 ) to make sure your translation is clamped to integer values.   ;  Thank you everyone for you suggestions. my professor is now telling me i need to use anti alias. is there any easy way to do this given my set up? how do i use it with motion?   ;  Okay that did it. I enabled anti alias and all my problems went away! the reason my display was jerking was because it was waiting to hit the next pixel. Anti alias allowed it to move between the pixels!   