I’m trying to get a charachter to move across the screen smoothly, I have specified the following: glTranslatef(s, a, 0); with s and a changing in very small increments. Now by using these small increments the charachter does move across the screen smoothly, however, it is a very ‘slow’ process. I need to speed up the rate of this charachters movement.
As both of you have suggested, I put the data segment involving the charachter and movement into a display list. Nonetheless, the charachter still moves across the screen slowly. Here is my DISPLAY LIST:
glNewList(1, GL_COMPILE_AND_EXECUTE);
glPolygonMode(GL_FRONT, GL_FILL);
glPushAttrib(GL_CURRENT_BIT);
//HEAD OF MAIN CHARACHTER
glPushMatrix();
glTranslatef(s, a, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor3f(1.0, .92, .92);
glBegin(GL_POLYGON);
glVertex3f(.47f, .48f , -0.15f);
glVertex3f(.47f, .50f , -0.15f);
glVertex3f(.485f, .50f , -0.15f);
glVertex3f(.485f, .49f , -0.15f);
glVertex3f(.489f, .49f , -0.15f);
glVertex3f(.489f, .488f , -0.150f);
glVertex3f(.485f, .488f , -0.150f);
glVertex3f(.485f, .478f , -0.150f);
glEnd();
glPopMatrix();
//EYE OF MAIN CHARACHTER
glPushMatrix();
glTranslatef(s, a, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor3f(0.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(.480f , .490f , -0.150f);
glVertex3f(.485f , .499f , -0.150f);
glVertex3f(.485f , .490f , -0.150f);
glEnd();
glPopMatrix();
//MOUTH OF MAIN CHARACHTER
glPushMatrix();
glTranslatef(s, a, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor3f(0.65, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex3f(.482f , .480f , -0.150f);
glVertex3f(.482f , .482f , -0.150f);
glVertex3f(.485f , .482f , -0.150f);
glVertex3f(.485f , .480f , -0.150f);
glEnd();
glPopMatrix();
//HAIR OF MAIN CHARACHTER
glPushMatrix();
glTranslatef(s, a, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor3f(0.65, 0.50, 0.0);
glBegin(GL_POLYGON);
glVertex3f(.469f , .497f , -0.150f);
glVertex3f(.472f , .501f , -0.150f);
glVertex3f(.485f , .501f , -0.150f);
glVertex3f(.485f , .497f , -0.150f);
glVertex3f(.47f , .492f , -0.150f);
glEnd();
glPopMatrix();
//EAR OF MAIN CHARACHTER
glPushMatrix();
glTranslatef(s, a, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor3f(1.00, 0.75, 0.75);
glBegin(GL_POLYGON);
glVertex3f(.473f , .487f , -0.150f);
glVertex3f(.471f , .492f , -0.150f);
glVertex3f(.478f , .487f , -0.150f);
glEnd();
glPopMatrix();
//BODY OF MAIN CHARACHTER
glPushMatrix();
glTranslatef(s, a, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor3f(.40, 0.40, 0.40);
glBegin(GL_POLYGON);
glVertex3f(.470f , .455f , -0.150f);
glVertex3f(.470f , .479f , -0.150f);
glVertex3f(.485f , .479f , -0.150f);
glVertex3f(.485f , .455f , -0.150f);
glEnd();
glPopMatrix();
//LEGS OF MAIN CHARACHTER
glPushMatrix();
glTranslatef(s, a, 0);
glClear(GL_DEPTH_BUFFER_BIT);
glColor3f(.40, 0.40, 0.40);
glBegin(GL_POLYGON);
glVertex3f(.471f , .445f , -0.150f);
glVertex3f(.471f , .455f , -0.150f);
glVertex3f(.484f , .455f , -0.150f);
glVertex3f(.484f , .445f , -0.150f);
glEnd();
glPopMatrix();
glPopAttrib();
glEndList();
I should note that the charachter is moving across a very large background texture. Maybe this is where the problem really is?
www.geocities.com/zadeh1979/grass3