Is there a way to acheive scissor effect with non rectangular shapes ??
You can use the stencil buffer.
use the stencil buffer:
.
draw your scene first…
.
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS,1,1);
glStencilOp(GL_REPLACE,GL_REPLACE,GL_REPLACE);
.
draw your clipping-shape
.
// to draw inside the clipping shape…
glStencilFunc(GL_EQUAL,1,1);
// to draw outside the clipping shape use:
// glStencilFunc(GL_NOTEQUAL,1,1);
glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
.
draw the part out your scene inside the clipping-shape
.
glDisable(GL_STENCIL_TEST);
that’s all.
btw.: if you have only one clipping-shape to draw, you probably should clear the stencil buffer together with the other buffers within one single glClear call.