Jump to content
  • Advertisement
Sign in to follow this  
Mczaar

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.

If you intended to correct an error in the post then please contact us.

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

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!