why when I rotatate my surface, it flicking?

I used double buffer

It should not flicker if you have good hardware. I do not know… perhaps if you give some more details.

Look into Backface Culling. If your box is trying to render both the front and the back of the object at the same time, it may flicker. If you use backface culling, you will not render the back of the object. (speeds up your prog, too!)

Maybe you put the camera transform in the projection matrix? This only applies if you’re using lighting though.

Thank you so much for all of you, I got a lot of help sice I joined the forums two days ago.
I have tried the back face culling. It doesn’t work. About the camera, this is my code:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,1,10,100);
gluLookAt(0,0,20, 0,0,0, 0,1,0);
glMatrixMode(GL_MODELVIEW);

Is it right? yes, I use lighting.

[This message has been edited by ym (edited 07-19-2001).]

I can see a major problem in your setup. gluLookAt is used to set up the viewpoint, which should actually be done with the ModelView matrix.

If you use lighting or fog and are setting up your viewpoint with the projection matrix, you’re likely to run into problems. You would also have problems if you did set up your projection in the modelview matrix…

So, you should do the following:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,1,10,100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,20, 0,0,0, 0,1,0);

Now, if this does not solve the problem, feel free to post more of your code (or e-mail it to me if you wish).

Hope this will help.

Best regards.

Eric

thanks a lot, but it still doesn’t work, it happens only when I rotate the surface to some angle. When it became very shinning . Here is the code:
void display(void)
{
int i, j;
GLfloat ambient2[]={1,0,0,1};
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPushMatrix ();
glRotatef(spin,0,1,0);

glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4,
0, 1, 12, 4, &ctrlpoints1[0][0][0]);
for (j = 0; j <=20; j++) {
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= 20; i++)
{
glMaterialfv(GL_FRONT,GL_AMBIENT,ambient2);
glEvalCoord2f((GLfloat)i/20.0, (GLfloat)j/20.0);
glEvalCoord2f((GLfloat)j/20.0, (GLfloat)i/20.0);

  }

glEnd();
}

glPopMatrix ();
glutSwapBuffers();
spin+=1;
}
void init(void)
{

GLfloat mat_diffuse[]={1,1,1,1.0};
GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
GLfloat mat_shininess[]={1.0};
GLfloat light_position1[]={1.0,5.0,1.0,0.0};

glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,mat_diffuse);
glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,mat_specular);
glMaterialfv(GL_FRONT_AND_BACK,GL_SHININESS,mat_shininess);

glClearColor (.0, .0, .0, 1.0);
glLightfv(GL_LIGHT0,GL_POSITION,light_position1);

glEnable(GL_LIGHT0);
glDepthFunc(GL_LEQUAL);
glEnable(GL_LIGHTING);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);

glEnable(GL_MAP2_VERTEX_3);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,1,10,100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,20, 0,0,0, 0,1,0);
}