Here is my latest code. I'll try to delete my debugging stuff. Hope I 'll not delete something important. The code basically works, it does apply the stencil - to show only data INSIDE the stencil circle. BUT ONLY when I enable viewing of the stencil AND data being written to the color buffer. I have highlighted the code. I was under the impression this is ONLY for viewing the stencil, but apparently not. Obviously I do not have to re-able the color buffer , hence I get BOTH - stencil and the stencilled "fragment". I have no idea how to proceed and where is my error.
//
glClear(
GL\_STENCIL\_BUFFER\_BIT | GL\_DEPTH\_BUFFER\_BIT | GL\_COLOR\_BUFFER\_BIT);
glDisable( GL\_STENCIL\_TEST);
glEnable(GL\_STENCIL\_TEST);
// clear all three buffers
glClearStencil(0x0);
glClear(
GL\_STENCIL\_BUFFER\_BIT | GL\_DEPTH\_BUFFER\_BIT | GL\_COLOR\_BUFFER\_BIT);
glStencilMask(GL\_TRUE); // MUST enable writing to stencil buffer (??)
**// turn off writing to color buffer
glColorMask(GL\_FALSE, GL\_FALSE, GL\_FALSE, GL\_FALSE);
// enable only to verify the stencil
//glColorMask(GL\_TRUE, GL\_TRUE, GL\_TRUE, GL\_TRUE);**
// setup stencil function
// function - test always are ref and mask bogus , ignored ?
// referrence
// mask
glStencilFunc(GL\_ALWAYS, 1, 1);
// setup stencil operation
//glStencilOp(GL\_REPLACE, GL\_REPLACE, GL\_KEEP); // ??
// blank here
//glStencilOp(GL\_KEEP, GL\_KEEP, GL\_REPLACE);
// get stencil
// TODO need parameter here to verify
parameter\_stencil = 42;
parameter\_stencil = Stencil(parameter\_stencil); // parameter);
glFlush();
// blank here
// switch keep area
if (parameter\_stencil == 0) {
printf(
"\\nStencil full circle parameter %i @function %s @line %i",
parameter\_stencil, \_\_FUNCTION\_\_, \_\_LINE\_\_);
glStencilFunc(GL\_EQUAL, 1, 1);
} // keep inside circle
else {
printf(
"\\nStencil last circle parameter %i @function %s @line %i",
parameter\_stencil, \_\_FUNCTION\_\_, \_\_LINE\_\_);
glStencilFunc(GL\_NOTEQUAL, 1, 1);
} // keep all outside of stencil
{
// apply stencil
//int OpenGL\_Render\_RealAxis(int parameter = 0)
//OpenGL\_Render\_RealAxis(); // int parameter = 0)
OpenGL\_Render\_Plus\_IMG\_Axis(); //int parameter = 0)
//OpenGL\_Render\_Minus\_IMG\_Axis(5); //passed temporary last circle as parameter = 0)
}
from here I am not sure how to display only the rendered frag