Thank you very much cylab and lhkbob.Now i see the rect.I did what cylab told me,i think the reason is i don’t know OPENGL.Whatever thank you, i learned a lot.
something i still can’t understand:
CODE 1:
gl.glTranslatef(0.0f, 0.0f, -3.0f);
gl.glPushMatrix();
gl.glBegin(GL.GL_QUADS);
gl.glVertex3f(-1f, 1f, -1f);
gl.glVertex3f( 1f, 1f, -1f);
gl.glVertex3f( 1f, -1f, -1f);
gl.glVertex3f(-1f, -1f, -1f);
gl.glEnd();
gl.glPopMatrix();
CODE 2:
gl.glPushMatrix();
gl.glTranslatef(0.0f, 0.0f, -3.0f);
gl.glBegin(GL.GL_QUADS);
gl.glVertex3f(-1f, 1f, -1f);
gl.glVertex3f( 1f, 1f, -1f);
gl.glVertex3f( 1f, -1f, -1f);
gl.glVertex3f(-1f, -1f, -1f);
gl.glEnd();
gl.glPopMatrix();
CODE 3:
gl.glPushMatrix();
gl.glBegin(GL.GL_QUADS);
gl.glVertex3f(-1f, 1f, -1f);
gl.glVertex3f( 1f, 1f, -1f);
gl.glVertex3f( 1f, -1f, -1f);
gl.glVertex3f(-1f, -1f, -1f);
gl.glEnd();
gl.glPopMatrix();
gl.glTranslatef(0.0f, 0.0f, -3.0f);
CODE 1 and CODE 2 have the same result,CODE 3 doesn’t.
What i think is glTranslatef move current coordinate ZERO to where i specified,and glPushMatrix,glPopMatrix is a way to save current coordinate.
Why CODE 3 not works?(i know it must be another stupid question…)