How to display shaded triangles and their edges?


I would like to display shaded model, consisted of triangular faces.

I want the edges of every visible triangle to be displayed in solid black.

What command with what argument should I call?

google(“render GL_LINE mode opengl”);
some command like this?

typo, i ment line, not wire

[This message has been edited by davepermen (edited 09-10-2002).]


You could say the same inane thing about many questions here. One of the reasons people post here is for quick and easy help, it’s convenient, it is not exclusively for stuff you cannot find elsewhere. Don’t tell people to RTFM when they post a legitimate question to the correct forum.

Thank you for trying to help!

Unfortunately, what the article you suggested
does not help. I tried to use glPolygonMode()
before I posted my question.

It allows me to display either wirefamed or shaded model, but not both simultaneously.

Also, wireframe mode does not do hidden lines removal; it just displays (with shading) all edges of front triangles. So if the model is not concave then front edges which should be hidden are displayed.

There is definetely a way to display shaded model with edges. I saw it in a few systems but I do not know how they do that.

okay, another hint: multipass:

draw the filled mesh
draw the line mesh

and because of z-fighting, check PolygonOffset as well…

you can’t do it at the same time, because the gpu has to set up different rastericers for each one (and you normaly want different pixelshading/texturing/coloring as well for the lines… else you would not see them…)

Yes, multipass works!

I solved z-fighting by calling

glDepthFunc( GL_LEQUAL );

Thank you very much!