# OpenGL Problem with triangle strips for 3d mesh and normals

This topic is 2607 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello!
I'm new to opengl programing. I'm currently making animation of cave shaft formation. I have a set of coordinats for profiles of the shaft along the z-axis. My plan is to make a 3d mesh from this data and to do that I've decieded to use TRIANGLE_STRIPS. The way I did this was that I've created multiple strips like this:

 1-----12 5-----6 | / | | / | | / | | / | 9-----10 3-----4 | / | | / | | / | | / | 7------8 1-----2 1 And so on and on. (the strips are longer of course, so they come all the way around the shaft.)

The code how I do that is something like that:
//FOR EACH STRIP
glBegin(GL_TRIANGLE_STRIP);
glVertex3f(x1 y1, z2); //first vertex
glVertex3f(x2, y2, z2); //second vertex
loop
glNormal3f(nx, ny, nz); //normal
glVertex3f(x, y, z); //every next vertex
end loop
glEnd();

My questions are:
1. Is this the right way to do it? Because now I have problems with normals. I would like to use GL_SMOOTH shading and for that as I understand I need to calculate normals of vertices? But in my case vertex 10 and 3 are the same so there would be two normals??? Is that a problem?

2. And is there any other way to create multiple strips? Or the solution with strips is maybe not the best one?

3. Another problem is, that this strips are not of equal length. Some are shorter then others.

1. 1
2. 2
Rutin
25
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 22
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631764
• Total Posts
3002210
×