anuchka
09-14-2008, 08:16 AM
Hi
1.I'm using stencil test to draw ceilings for non-convex polygons
Sometimes I'm getting strange display ,like the attached image ,i.e. I can see transparent lines ,and also white stripes around the frame
http://img238.imageshack.us/my.php?image=screenhunter023eu1.jpg
My code:
glEnable(GL_STENCIL_TEST);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glStencilFunc(GL_ALWAYS, 0x1, 0x1);
glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
for (int ib = 0; ib < iNumBuildings;ib++)
{
glBegin(GL_TRIANGLE_FAN);
for(int iw = 0;iw < buildings[ib].iNumWalls;iw++)
glVertex4f(.vertex coordinates..);
glEnd();
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glStencilFunc(GL_EQUAL, 0x1, 0x1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
for (int ib = 0; ib < iNumBuildings;ib++)
{
glBegin(GL_TRIANGLE_FAN);
for(int iw = 0;iw < buildings[ib].iNumWalls;iw++)
glVertex4f(...vertex coordinates...)
glEnd();
}
glDisable(GL_STENCIL_TEST);
Any suggestions?
Thanks
1.I'm using stencil test to draw ceilings for non-convex polygons
Sometimes I'm getting strange display ,like the attached image ,i.e. I can see transparent lines ,and also white stripes around the frame
http://img238.imageshack.us/my.php?image=screenhunter023eu1.jpg
My code:
glEnable(GL_STENCIL_TEST);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glStencilFunc(GL_ALWAYS, 0x1, 0x1);
glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT);
for (int ib = 0; ib < iNumBuildings;ib++)
{
glBegin(GL_TRIANGLE_FAN);
for(int iw = 0;iw < buildings[ib].iNumWalls;iw++)
glVertex4f(.vertex coordinates..);
glEnd();
}
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glStencilFunc(GL_EQUAL, 0x1, 0x1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
for (int ib = 0; ib < iNumBuildings;ib++)
{
glBegin(GL_TRIANGLE_FAN);
for(int iw = 0;iw < buildings[ib].iNumWalls;iw++)
glVertex4f(...vertex coordinates...)
glEnd();
}
glDisable(GL_STENCIL_TEST);
Any suggestions?
Thanks