Jump to content
  • Advertisement
Sign in to follow this  

Problem with normals of triangle-strips

This topic is 2755 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

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 smile.png

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
Sign in to follow this  

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!