What i’m trying to do is to render a wireframe cilinder for example.
It is composed of triangles but i do not want to show all the edges; Ex
| / | <— I want the diagonal edge off
I once sow an OpenGL command that prevented some primitives from being drawn
( I would rather use that instead of making my own “draw or not” rutine )
There is something called an “edge flag”. I don’t know the details, but that is probably what you want.
EDGE_FLAG sounds like what you want. It’s mentioned in vertex arrays and tesselation topics in the red book. Otherwise you’re going to have to create the vertices of the wireframe manually and skip drawing the diagonals.
The simplest solution is probably to tesselate the cylinder yourself, then you can keep a list of all edges and render the ones you want with GL_LINES or you can compose the cylinder with quads instead and use polygonMode to get wireframe rendering. Both those cases would be fairly simple to implement and very flexible.
we’re going to find out which edges shouldn’t be drawn as they’re shared by 2 triangles of the same normal vector.
i would do it like that:
- put to an array of size 3 * traingles all edges - each represented as 7 values (x1, y1, z1, x2, y2, z2, face_id) - hope it’s clear enough
- sort them
-first by x1, then if equal
-by y1, then if equal
-by z1, then if equal
-by x2, then if equal
-by y2, then if equal
-by z2, then if equal
-by normal(face_id), then if equal don’t care
…use quicksort for this
…after this step all edges having same 3d coordinates and belonging to faces having same normal vector are neighbours in your array
- now you just go from first to last field and IF you find i-th and (i+1)-th edges having same coordinates and belonging to faces of the same normal vector THEN you know they shouldn’t be drawn
that’s really simple, hope you (I) understood me (you)
[This message has been edited by MickeyMouse (edited 03-18-2002).]