PDA

View Full Version : glPolygonMode ..., GL_LINE



10-24-2001, 06:36 AM
How can we do, do make a vizualisation with the elimination of the hidden parties (Borders of polygons) when le mode of glPolygonMode is GL_LINE ?

Gavin
10-24-2001, 06:59 AM
You mean you want to draw in GL_LINE but also have OpenGL only draw front facing polygon edges, i.e. backface culling. So the object is *not* see through?

10-24-2001, 07:12 AM
Yes, I want to see only the polygon edges with the backface culling ! is there a possibility ?

10-24-2001, 07:16 AM
Actually I use a wrong code :
in glPolygoneMode .. GL_FILL,
I draw GL_QUADS and I draw over the 4 GL_LINES... I think that very a bad code !

Gavin
10-25-2001, 01:01 AM
Don't know, I have wondered this, you could bodeg it by drawing the polygons in white (if that is your background colour) and the drawing them again with GL_LINE in black sorta thing.

10-25-2001, 01:09 AM
Yes, that I do. I haved try to use glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT with the glpolygoneMode GL_LINE but any result (Maybe I mak error !)

Tron
10-25-2001, 02:38 AM
what about this idea:

1. set poly-mode to GL_FILL
2. set depth-func to less or equal
3. disable color-writing and ONLY enable depth-writing (this is possible, isn't it? if not, just draw the whole scene in black)
4. draw the whole scene
5. change the poly-mode to GL_LINE
6. set depth func to equal
7. renenable color-writing and disable depth-writing
8. set the color to white for a nice wireframe
9. draw the scene again

that should work, but u have to draw the scene twice

10-25-2001, 05:39 AM
Originally posted by Tron:
what about this idea:

1. set poly-mode to GL_FILL
2. set depth-func to less or equal
3. disable color-writing and ONLY enable depth-writing (this is possible, isn't it? if not, just draw the whole scene in black)
4. draw the whole scene
5. change the poly-mode to GL_LINE
6. set depth func to equal
7. renenable color-writing and disable depth-writing
8. set the color to white for a nice wireframe
9. draw the scene again

that should work, but u have to draw the scene twice

For the point 2 : glDepthFunc cfLess Or cfEqual
but what the point 3 ?
Thanks
N.

Tron
10-25-2001, 05:58 AM
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);


this should deactivate writing to the colorbuffer.




glDepthMask(GL_FALSE);


this deactivates depth writing.


complete code would be:




glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // 0 (;
glPolygonMode(GL_FILL); // 1
glDepthFunc(GL_LEQUAL); // 2
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // 3
glDepthMask(GL_TRUE); // 3
DrawTheScene(); // 4, all the things you want to draw
glPolygonMode(GL_LINE); // 5
glDepthFunc(GL_EQUAL); // 6
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // 7
glDepthMask(GL_FALSE); // 7
glColor3f(1.0f, 1.0f, 1.0f); // 8, and of course deactive all color arrays, textures etc.
DrawTheScene(); // 9, all the things you want to draw


[This message has been edited by Tron (edited 10-25-2001).]