I am a beginner of OpenGL,and I am in trouble about the order of the graphics.
first ,when I write the program like this:
glTranslatef(0.0f, 0.0f, -91.5f);
glEnable(GL_LINE_STIPPLE);
glLineStipple(2,0x0101);
glPushMatrix();
glBegin(GL_LINES);
glVertex3f(-31.5,84.5,-2.0);
glVertex3f(0.0,0.0,-2.0);
glEnd();
glPopMatrix();//draw a line
glLineStipple(2,0x00FF);
glPushMatrix();
glBegin(GL_LINES);
glVertex3f(0.0,0.0,-2.0);
glVertex3f(81.5,84.5,-2.0);
glEnd();
glPopMatrix();
glDisable(GL_LINE_STIPPLE);
//draw second line
glPushMatrix();
glTranslatef(-20.0f, 0.0f, 0.0f);
glBegin(GL_QUADS);
glVertex3f(-53.0,-52.5,-1.5);
glVertex3f(52.0,-52.5,-1.5);
glVertex3f(83.0,52.5,-1.5);
glVertex3f(-22.0,52.5,-1.5);
glEnd();
glPopMatrix();
//draw a quad
auxWireSphere(20.5);
auxSwapBuffers();
in this case ,two lines and a quad are draw before the sphere.but when i put the sentence auxWireSphere(20.5);before glEnable(GL_LINE_STIPPLE);,only a sphere is paint.and I have use the depth buffer.
I don’t know why and how to correct it.
thank you very much!