The following snippet draws a gray square.
glColor3b(50, 50, 50); glBegin(GL_QUADS); glVertex3f(-1.0, +1.0, 0.0); // top left glVertex3f(-1.0, -1.0, 0.0); // bottom left glVertex3f(+1.0, -1.0, 0.0); // bottom right glVertex3f(+1.0, +1.0, 0.0); // top right glEnd();
In my application, behind this single square exists a colored cube.
What function should I use to make square (and only this square) opaque?
In the init function, use these two lines:
And in your render function, ensure that
glColor4fis used instead ofglColor3f, and set the 4th argument to the level of opacity required.