bleifrei

05-03-2003, 03:59 AM

Please help!

I now there are many preceding tread about triangle strip & OGL, but neither could give me the answer for my silly problem. I've read a lot of paper and article about triangle strip generation. Nearly all of them says, that after creating the adjacency structure and choosing an initial triangle, we should choose the initial direction where the given triangle has less neigbours. O.K.

So I'd like to create a strip list of a brick. I choose triangle 'A' for the first triangle in the strip and follow the next method for creating strip: because every triangle has 3 neigbours I choose triangle who share the longest edge with the actual triangle, and so on.

The first part of the triangle strip look like: A,B,C,D....

Here is the brick with the front faces(sorry for the following ASCII nightmare): A,B,C,D are the faces and numbers in the parentheses are the indices of the vertices.

(0) (1)

_______________

/ A .... /|

/ ....''''' / |

(3)/____________B_/(4)

| . | |

| . | |

| . C | |

| . | |

| . | |

| . | |

| . | |

| D . | |

| . | /

|______________|/

(7) (6)

And after all I tried to draw the strip with OGL:

Here is a piece of the scene drawing code:

...

static GLfloat cv[8][3] = {

{0.0, 5.0, 0.0},// 0

{3.0, 5.0, 0.0},// 1

{3.0, 5.0, 2.0},// 2

{0.0, 5.0, 2.0},// 3

{0.0, 0.0, 0.0},// 4

{3.0, 0.0, 0.0},// 5

{3.0, 0.0, 2.0},// 6

{0.0, 0.0, 2.0}// 7

};

...

glFrontFace(GL_CCW);

glBegin(GL_TRIANGLE_STRIP);

glVertex3fv(&cv[0][0]);

glVertex3fv(&cv[3][0]);

glVertex3fv(&cv[1][0]);

glVertex3fv(&cv[2][0]);

glVertex3fv(&cv[6][0]);

...

glEnd();

Until I draw the vertex (2) everything is OK, triangles draw front faced, but when I add vertex (6) to the list the third triangle will not be the face 'C', but the triangle with vertices (1), (2) and (6). And I don't what did or understand wrong...

1. What did wrong during the outlined project?

2. Is the triangulation method of a mesh is affect on the strip generation and drawing?

3. With the order of the first three vertices we suggest the face drawing CW or CCW and any additional vertex is build by OGL according the starting face direction. Did I understood well the GL_TRIANGLE_STRIP drawing method?

4. How should I organize the vertices in my triangle strip(A,B,C,D...) to achieve the desired picture?

5. Any suggestion in this case?

Thanks if you can answer my questions.

Brown

I now there are many preceding tread about triangle strip & OGL, but neither could give me the answer for my silly problem. I've read a lot of paper and article about triangle strip generation. Nearly all of them says, that after creating the adjacency structure and choosing an initial triangle, we should choose the initial direction where the given triangle has less neigbours. O.K.

So I'd like to create a strip list of a brick. I choose triangle 'A' for the first triangle in the strip and follow the next method for creating strip: because every triangle has 3 neigbours I choose triangle who share the longest edge with the actual triangle, and so on.

The first part of the triangle strip look like: A,B,C,D....

Here is the brick with the front faces(sorry for the following ASCII nightmare): A,B,C,D are the faces and numbers in the parentheses are the indices of the vertices.

(0) (1)

_______________

/ A .... /|

/ ....''''' / |

(3)/____________B_/(4)

| . | |

| . | |

| . C | |

| . | |

| . | |

| . | |

| . | |

| D . | |

| . | /

|______________|/

(7) (6)

And after all I tried to draw the strip with OGL:

Here is a piece of the scene drawing code:

...

static GLfloat cv[8][3] = {

{0.0, 5.0, 0.0},// 0

{3.0, 5.0, 0.0},// 1

{3.0, 5.0, 2.0},// 2

{0.0, 5.0, 2.0},// 3

{0.0, 0.0, 0.0},// 4

{3.0, 0.0, 0.0},// 5

{3.0, 0.0, 2.0},// 6

{0.0, 0.0, 2.0}// 7

};

...

glFrontFace(GL_CCW);

glBegin(GL_TRIANGLE_STRIP);

glVertex3fv(&cv[0][0]);

glVertex3fv(&cv[3][0]);

glVertex3fv(&cv[1][0]);

glVertex3fv(&cv[2][0]);

glVertex3fv(&cv[6][0]);

...

glEnd();

Until I draw the vertex (2) everything is OK, triangles draw front faced, but when I add vertex (6) to the list the third triangle will not be the face 'C', but the triangle with vertices (1), (2) and (6). And I don't what did or understand wrong...

1. What did wrong during the outlined project?

2. Is the triangulation method of a mesh is affect on the strip generation and drawing?

3. With the order of the first three vertices we suggest the face drawing CW or CCW and any additional vertex is build by OGL according the starting face direction. Did I understood well the GL_TRIANGLE_STRIP drawing method?

4. How should I organize the vertices in my triangle strip(A,B,C,D...) to achieve the desired picture?

5. Any suggestion in this case?

Thanks if you can answer my questions.

Brown