Sign in to follow this  

Problem with normals of triangle-strips

Recommended Posts

Hey guys,

I have some trouble to set the vertex-normals for a triangle-strip, which is stored within one big array.
At the end of each row, I draw 2 "dummy"-triangles to be able to jump to the beginning of the next row.
Which means, if I want to draw:
| / | / |
| / | / |
My ordering is 1,2,4,5,7,8,8,2,3,5,6,8,9.

When I don't use light and shading, everything looks fine. But when I turn on lightning, the normals come into play and I have a lot of stripes within the rendered surface. Has anybody an idea how I can avoid these stripes? Have I forgot to initialize something?

I have no idea - its the first time that I want to shade a rendered surface.

Thanks a lot for your help [img][/img]

void initGL(){
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { 0.0f, 800.0f, 2.0f, 1.0f };
glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
glLightfv(GL_LIGHT0, GL_POSITION,LightPosition);

Here you can see the result...

Share this post

Link to post
Share on other sites
Perhaps your normals are wrong. They, obviously, should not contradict what other adjacent triangles have at the same vertex (different strip).

Btw. Unrelated, but i mention anyway. Might want to use just indexed triangles - by my count, the days where strips were worth a damn are long gone (immho).

Share this post

Link to post
Share on other sites
ok, thanks a lot...I will check my normals....

@triangle-strips: I know...and it was not my idea...but its part of a university-project and we have to use triangle strips :(

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