but the words you mouthed were sweeter

June 3rd, 2012

glEnable (GL_STENCIL_TEST);
glClearStencil (0);
glStencilFunc (GL_ALWAYS, 0x01, 0x01);
glStencilOp (GL_KEEP, GL_REPLACE, GL_REPLACE);
glColor4ub (0x00, 0x00, 0x00, 0x00);
[... draw the stencil shape ...]
glStencilFunc (GL_EQUAL, 0x01, 0x01);
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
glColor4ub (0x00, 0x00, 0x00, 0xff);
[... draw things constrained to the stencil shape ...]
glDisable (GL_STENCIL_TEST);

also if someone wants to enlighten me as to why this code doesn’t stencil anything i’d be much obliged.