longshot
02-16-2003, 06:22 AM
I have a small viewport wich i want to reshape from a square to a circle.
I mean the small viewport on the bottom right of this screenshot:
http://www.gunfight.net/img/19.jpg
I was planning to use the stencil buffer to not draw outside the viser, using the following code:
if (view->IS_STENCIL){
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glColorMask(0,0,0,0);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glDisable(GL_DEPTH_TEST);
} else if (view->USES_STENCIL){
glEnable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glColorMask(1,1,1,1);
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
} else {
glDisable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glColorMask(1,1,1,1);
}
and another viser picture:
http://www.gunfight.net/img/20.jpg
First, the big viewport is drawn, doing nothing with stenciling. Then a view is drawn using view->IS_STENCIL with the last viser-image. Then the other underlying viewports under the viser are drawn.
The problem is, it just does not work for a bit. It just slows down everything to 1 fps...
Can someone help me with this? know a good tutorial or a hint?.
I mean the small viewport on the bottom right of this screenshot:
http://www.gunfight.net/img/19.jpg
I was planning to use the stencil buffer to not draw outside the viser, using the following code:
if (view->IS_STENCIL){
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
glColorMask(0,0,0,0);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glDisable(GL_DEPTH_TEST);
} else if (view->USES_STENCIL){
glEnable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glColorMask(1,1,1,1);
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
} else {
glDisable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glColorMask(1,1,1,1);
}
and another viser picture:
http://www.gunfight.net/img/20.jpg
First, the big viewport is drawn, doing nothing with stenciling. Then a view is drawn using view->IS_STENCIL with the last viser-image. Then the other underlying viewports under the viser are drawn.
The problem is, it just does not work for a bit. It just slows down everything to 1 fps...
Can someone help me with this? know a good tutorial or a hint?.