PDA

View Full Version : Only drawing some edges..



barsanpipu
03-16-2002, 04:15 PM
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 )

Jambolo
03-17-2002, 10:30 AM
There is something called an "edge flag". I don't know the details, but that is probably what you want.

Furrage
03-17-2002, 01:15 PM
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.

harsman
03-18-2002, 05:25 AM
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.

MickeyMouse
03-18-2002, 06:39 AM
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:

1. 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
2. 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 http://www.opengl.org/discussion_boards/ubb/smile.gif
....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
3. 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) http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by MickeyMouse (edited 03-18-2002).]