PDA

View Full Version : Hidden line setting will lead to glEdgeFlag() no function ?



plover
08-20-2002, 09:23 PM
Hi!

I am working on a project to add edge line on a model. I use glPolygonOffset() to superimpose the edge line on a polygon model. To define the model's edge, I use glEdgeFlag() to flag on model's edge. But I find this approach works on some computer but cannot work on some graphic card (e.g.,my card is Elsa Synergy II ). Edge that is setted to be glEdgeFlag(FALSE) cannot be hidden once glPolygonOffset() is used. Any idea to solve the problem? Here attached is my code:
void AddModelEdge(void)
{
// Clear the window
glClear(GL_COLOR_BUFFER_BIT);

glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);

glDisable(GL_LIGHTING);

/***///If I comment out these two lines,
// the code works OK
glEnable(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(-1.5,-0.5);
/***/

// Save matrix state and do the rotation
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
glRotatef(yRot, 0.0f, 1.0f, 0.0f);


// Begin the triangles
glBegin(GL_TRIANGLES);

glEdgeFlag(bEdgeFlag);
glVertex2f(-20.0f, 0.0f);
glEdgeFlag(TRUE);
glVertex2f(20.0f, 0.0f);
glEdgeFlag(TRUE);
glVertex2f(0.0f, 40.0f);

glEdgeFlag(TRUE);
glVertex2f(-20.0f,0.0f);
glEdgeFlag(TRUE);
glVertex2f(-60.0f,-20.0f);
glEdgeFlag(bEdgeFlag);
glVertex2f(-20.0f,-40.0f);

glEdgeFlag(TRUE);
glVertex2f(-20.0f,-40.0f);
glEdgeFlag(TRUE);
glVertex2f(0.0f, -80.0f);
glEdgeFlag(bEdgeFlag);
glVertex2f(20.0f, -40.0f);

glEdgeFlag(TRUE);
glVertex2f(20.0f, -40.0f);
glEdgeFlag(TRUE);
glVertex2f(60.0f, -20.0f);
glEdgeFlag( bEdgeFlag);
glVertex2f(20.0f, 0.0f);

// Done drawing Triangles
glEnd();

// Restore transformations
glPopMatrix();

// Flush drawing commands
glutSwapBuffers();
}