I am trying to learn the usage of stencil buffer. I try to create reflection of an object on a floor.
But while i introduce the blue block the reflected object is not rendered.
With no blue block I see a solid object, floor and the object which is supposed to be the reflection of the first object appears partly hidden behind the floor!!
Below is the code. Please help me.
…
glEnable(GL_STENCIL_TEST);
glColorMask(0, 0, 0, 0);
glDisable(GL_DEPTH_TEST);
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
draw_floor();
glColorMask(1, 1, 1, 1);
glEnable(GL_DEPTH_TEST);
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
…