Hi guys,
It’s just one problem after another…
I’m trying to draw something directly to the front buffer, but unfortunately it’s just not working. Here’s my code, using the NeHe tutorials for testing again:
glDrawBuffer(GL_FRONT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
// draw a triangle to the front buffer
glTranslatef(-1.5f,0.0f,-6.0f);
glColor3f(1.0f,0.0f,0.0f);
glBegin(GL_TRIANGLES);
glVertex3f( 0.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glEnd();
// draw a square to the back buffer
glDrawBuffer(GL_BACK);
glTranslatef(3.0f,0.0f,0.0f);
glColor3f(0.5f,0.5f,1.0f);
glBegin(GL_QUADS);
glVertex3f(-1.0f, 1.0f, 0.0f);
glVertex3f( 1.0f, 1.0f, 0.0f);
glVertex3f( 1.0f,-1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glEnd();
// swap back to front
SwapBuffers(hDC);
When I run this, it should only display the square - which was drawn to the back buffer, right? Well what I’m seeing is both the triangle and square on the screen at the same time, like it’s simply drawing both objects to the back buffer.
Any help?!
Daz.