Switched from rough zoffset to glpolygonoffset for hiddenline and flatlines modes. Less zfighting...

This commit is contained in:
Paolo Cignoni 2006-02-09 10:00:39 +00:00
parent ce453edfb1
commit 287fd21a07
1 changed files with 20 additions and 10 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.17 2005/12/15 14:05:59 spinelli
add test (tm==TMPerWedgeMulti)
Revision 1.16 2005/12/14 00:18:43 cignoni Revision 1.16 2005/12/14 00:18:43 cignoni
multiple texture support multiple texture support
@ -524,33 +527,40 @@ void DrawPoints()
void DrawHidden() void DrawHidden()
{ {
const float ZTWIST=HNParamf[HNPZTwist]; //const float ZTWIST=HNParamf[HNPZTwist];
glDepthRange(ZTWIST,1.0f); glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_LIGHTING_BIT );
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0, 1);
//glDepthRange(ZTWIST,1.0f);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE); glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
DrawFill<NMNone,CMNone,TMNone>(); DrawFill<NMNone,CMNone,TMNone>();
glDisable(GL_POLYGON_OFFSET_FILL);
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
//glDepthRange(0.0f,1.0f-ZTWIST);
glDepthRange(0.0f,1.0f-ZTWIST);
DrawWire<NMPerVert,CMNone>(); DrawWire<NMPerVert,CMNone>();
glDepthRange(0,1.0f); glPopAttrib();
// glDepthRange(0,1.0f);
} }
template <NormalMode nm, ColorMode cm, TextureMode tm> template <NormalMode nm, ColorMode cm, TextureMode tm>
void DrawFlatWire() void DrawFlatWire()
{ {
const float ZTWIST=HNParamf[HNPZTwist]; //const float ZTWIST=HNParamf[HNPZTwist];
glDepthRange(ZTWIST,1.0f); //glDepthRange(ZTWIST,1.0f);
glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_LIGHTING_BIT );
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0, 1);
DrawFill<nm,cm,tm>(); DrawFill<nm,cm,tm>();
glDepthRange(0.0f,1.0f-ZTWIST); glDisable(GL_POLYGON_OFFSET_FILL);
glPushAttrib(GL_CURRENT_BIT); //glDepthRange(0.0f,1.0f-ZTWIST);
glEnable(GL_COLOR_MATERIAL); glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT,GL_DIFFUSE); glColorMaterial(GL_FRONT,GL_DIFFUSE);
glColor3f(.3f,.3f,.3f); glColor3f(.3f,.3f,.3f);
DrawWire<NMPerVert,CMNone>(); DrawWire<NMPerVert,CMNone>();
glPopAttrib(); glPopAttrib();
glDepthRange(0,1.0f); //glDepthRange(0,1.0f);
} }
template <NormalMode nm, ColorMode cm> template <NormalMode nm, ColorMode cm>