Hello!I need help.
I’m puzzled and don’t know how to make stencil buffer work.Hope you could give me some hints.
I have a rendering thread in my windows program,here’s a piece of code cut from it:
//This while-loop renders the scene all the time,
//until the “game” stops running by other means.
glOrtho(0, winWidth, 0, winHeight, -1, 1);
//Here I want to draw a black rectangle in the lower part of my window.
//But the output on the screen doesn’t fit my need–the black rectangle wasn’t shown at all.
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
glStencilFunc(GL_NOTEQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glClearColor(0.4f, 0.4f, 0.6f, 0);
::SwapBuffers(pDC->GetSafeHdc());//pDC is ready before,dont worry about it.