Original Post
Hi, I am drawing two textures and a cylinder on my screen. First texture needs to be drawn over all the display screen. The second texture only occupies the lower right quadrant of the the screen, while the cylinder should also be over the entire screen. Problem: I am not able to arrange all of these. I want to cylinder to be the top most object, followed by second texture (occupying part of screen), and in the end to be the first texture. But in practice I get the following ordering. On top is second texture, followed by cylinder, and in the last is the first texture. My display code is as below: best wishes
glUseProgram(0);
GLUquadricObj* quadraticObject = gluNewQuadric( );
glColor4f(1.0,0.0,0.0,1.0);
glTranslatef(0.0,0.0,-250.0);
gluCylinder(quadraticObject, 50.0, 50.0, 500.0, 100, 100);
glColor4f(1.0,1.0,1.0,1.0);
// render image to screen
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glViewport(0, 0, width(), height());
glUseProgram(0);
glClearColor(1, 1, 1, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION); glLoadIdentity();
glMatrixMode(GL_MODELVIEW); glLoadIdentity();
if (generateBoxPlot3D){
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, txSecond);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(0, -1);
glTexCoord2f(0, 1); glVertex2f(0, 0);
glTexCoord2f(1, 1); glVertex2f( 1, 0);
glTexCoord2f(1, 0); glVertex2f( 1, -1);
glEnd();
}
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, txFirst);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(-1, -1);
glTexCoord2f(0, 1); glVertex2f(-1, 1);
glTexCoord2f(1, 1); glVertex2f( 1, 1);
glTexCoord2f(1, 0); glVertex2f( 1, -1);
glEnd();