PDA

View Full Version : hidden line removal (by lines, not polygon)



10-30-2000, 05:27 AM
I knew how to execute the hidden line removal by polygon mode.
namely....

written by Relic...

glPolygonMode(GL_FRONT, GL_FILL);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset((1.0f,1.0f);
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
glBegin(GL_POLYGON);
glVertex(....) // draw my model as polygons
glEnd();
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
glDisable(GL_POLYGON_OFFSET_FILL);

// Draw the model as polygons with GL_LINE mode
glPolygonMode(GL_FRONT, GL_LINE);
glBegin(GL_POLYGON);
glColor3ub(set appreciate colors);
glVertex(....) // draw my model as edges
glEnd();
glFinish();


But....

I want to execute the hidden line removal by lines

so..

The part I want to correct

glBegin(GL_POLYGON);
glColor3ub(set appreciate colors);
glVertex(....) // draw my model as edges
glEnd();
glFinish();

--------->

for{
glBegin(GL_LINES);
...
glVertex(the one vertex of two, consisted in one edge);
glVertex(another vertex);
glEnd();
}

Relic said...

The polygon offset works only for polygonal primitives, not for GL_POINTS or GL_LINE...

So...Can't I implement the hidden line removal by lines' DB?

Please help me!!

Kilam Malik
10-30-2000, 07:52 AM
Sure, you can do the second step with lines only and not with polygons. But the first step (drawing the polys in background-color) is needed in order to hide the hidden lines.

You can of course calculate your hidden line model mathematically, but it won't be fast enough to rotate in realtime.

Kilam.