@rjlwest wrote:
All I'm trying to do at the moment is to get one ofRectangle to stencil the other, but it's not working. I've set the stencilbits to 8. I've searched the forum and other people have always managed to get it working, I've tried their solutions but it just doesn't work for me.
glEnable(GL_STENCIL_TEST|GL_DEPTH_TEST); glClearStencil(0); glClearDepth(0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glStencilFunc(GL_ALWAYS, 1, 0); glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); ofSetColor(0, 255, 0); ofDrawRectangle(ofRectangle(20,380,100,100)); glStencilFunc(GL_EQUAL, 1, 0); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); ofSetColor(255, 0, 0); ofDrawRectangle(ofRectangle(40,400,100,100)); glDisable(GL_STENCIL_TEST);
Posts: 1
Participants: 1