racumin
10-29-2009, 03:23 AM
Hi, can I display rectangle r1 behind rectangle r2 even if I displayed r1 first? See code below
//this is r1
glBegin(GL_QUADS);
glTexCoord2d(0, 1);
glVertex2d(0, 100);
glTexCoord2d(1, 1);
glVertex2d(100, 100);
glTexCoord2d(1, 0);
glVertex2d(100, 0);
glTexCoord2d(0, 0);
glVertex2d(0, 0);
glEnd();
And then I created another rectangle r2 but I want this to be printed behind r1
//this is r2
glBegin(GL_QUADS);
glTexCoord2d(0, 1);
glVertex2d(0, 100);
glTexCoord2d(1, 1);
glVertex2d(100, 100);
glTexCoord2d(1, 0);
glVertex2d(100, 0);
glTexCoord2d(0, 0);
glVertex2d(0, 0);
glEnd();
Is there a function say for example "glDrawBehind()" where I will call before the glBegin() of r2? So that it will be displayed behind r1? Thanks!
//this is r1
glBegin(GL_QUADS);
glTexCoord2d(0, 1);
glVertex2d(0, 100);
glTexCoord2d(1, 1);
glVertex2d(100, 100);
glTexCoord2d(1, 0);
glVertex2d(100, 0);
glTexCoord2d(0, 0);
glVertex2d(0, 0);
glEnd();
And then I created another rectangle r2 but I want this to be printed behind r1
//this is r2
glBegin(GL_QUADS);
glTexCoord2d(0, 1);
glVertex2d(0, 100);
glTexCoord2d(1, 1);
glVertex2d(100, 100);
glTexCoord2d(1, 0);
glVertex2d(100, 0);
glTexCoord2d(0, 0);
glVertex2d(0, 0);
glEnd();
Is there a function say for example "glDrawBehind()" where I will call before the glBegin() of r2? So that it will be displayed behind r1? Thanks!