Sign in to follow this  

OpenGL Problem with triangle strips for 3d mesh and normals

Recommended Posts

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
[/code]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:
glVertex3f(x1 y1, z2); //first vertex
glVertex3f(x2, y2, z2); //second vertex
glNormal3f(nx, ny, nz); //normal
glVertex3f(x, y, z); //every next vertex
end loop

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.
Thank you for your help :)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this