candela
04-23-2011, 11:35 PM
hi,
To move in scene I use gluLookAt function so I have different vantage points, and when I try to apply the stenciling, no matter from which different point I'm viewing the scene via gluLookAt, stenciling is always at the same location.
That urged me to think that, to achieve proper effect of stenciling, I need to apply something to get the transformed shape and later send it to stencile processing functions because gluLookAt doesn't transform each objects "automagically" but the viewing point, whereas I'm always sending the untransformed shape to stenciling pipeline
FOR EXAMPLE:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glColorMask(0,0,0,0);
glClearStencil(0);
glEnable(GL_DEPTH_TEST);
glCullFace(GL_FRONT);
glutSolidSphere(0.6,16,16);
glEnable(GL_STENCIL_TEST);
glDepthMask(0);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
glCullFace(GL_BACK);
glutSolidOctahedron();
Even though I'm viewing from different angles the processed shapes is always same, so there is no way for stencil buffer to know that this shape is viewed from point A or from point B.
Comments will be appreciated,
Regards,
To move in scene I use gluLookAt function so I have different vantage points, and when I try to apply the stenciling, no matter from which different point I'm viewing the scene via gluLookAt, stenciling is always at the same location.
That urged me to think that, to achieve proper effect of stenciling, I need to apply something to get the transformed shape and later send it to stencile processing functions because gluLookAt doesn't transform each objects "automagically" but the viewing point, whereas I'm always sending the untransformed shape to stenciling pipeline
FOR EXAMPLE:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glColorMask(0,0,0,0);
glClearStencil(0);
glEnable(GL_DEPTH_TEST);
glCullFace(GL_FRONT);
glutSolidSphere(0.6,16,16);
glEnable(GL_STENCIL_TEST);
glDepthMask(0);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
glCullFace(GL_BACK);
glutSolidOctahedron();
Even though I'm viewing from different angles the processed shapes is always same, so there is no way for stencil buffer to know that this shape is viewed from point A or from point B.
Comments will be appreciated,
Regards,