View Full Version : How to display shaded triangles and their edges?

09-10-2002, 11:18 AM

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?

09-10-2002, 12:19 PM
google("render GL_LINE mode opengl");
some command like this? http://www.opengl.org/discussion_boards/ubb/biggrin.gif

typo, i ment line, not wire http://www.opengl.org/discussion_boards/ubb/biggrin.gif

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

09-10-2002, 02:20 PM
http://www.opengl.org/developers/documen...000000000000000 (http://www.opengl.org/developers/documentation/Specs/glspec1.1/node57.html#SECTION00654000000000000000)

09-10-2002, 02:44 PM
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.

09-11-2002, 05:13 AM
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.

09-11-2002, 05:22 AM
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..)

09-11-2002, 06:13 AM
Yes, multipass works!

I solved z-fighting by calling

glDepthFunc( GL_LEQUAL );

Thank you very much!