will the order of the graphics make differences?

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!

Things you draw will be drawn in strict order. If something touches the same pixels and is drawn later it will overwrite stuff you drew earlier.

Enabling the depthbuffer & depth testing will stop things drawn on top of other things from overwriting them and things will be visible based on their screen z depth.

You may want to try only drawing the first object then the first two objects etc. on various frames to see if things are simply being overwritten or not.

P.S. aux is a deprecated library I would discourage you from using it. GLUT would be a better choice.