Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


OpenGL Rotating Line Strips in OpenGL

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

I'm having a problem rotating line strips in OpenGL. When the line strip is first rendered, it appears just fine; however, as the line strip is rotated, it eventually disappears and then reappears as it approaches its original orientation. It seems that the "back" of the line strip isn't being shown, but this is only an assumption on my part. Any ideas on what might be wrong?


Share this post

Link to post
Share on other sites
Guest Anonymous Poster
I think this is due to your lighting / material setup. You should have the lights set to GL_LIGHT_MODEL_TWO_SIDE, and the appropriate color. You should set the material properties to the appropriate ambient and diffuse colors. for instance:

GLfloat ambient[] {0.5,0.5,0.5,1.0};
GLfloat diffuse[] {1.0,1.0,1.0,1.0};
glMaterialfv(GL_AMBIENT, ambient);
glMaterialfv(GL_DIFFUSE, diffuse);

will set up a "white" material with a half gray "unlit" color. this tends to work well to give the appropriate lighting cues, and yet not cause dissapearing lines. The glColor*() function gives the appropriate color to the object in case lighting is turned off... not needed unless you plan to turn lights off for some reason.

If you turn off lighting before drawing your lines, you will note that the line looks complete. I have found that adjusting the ambient material properties works well in lighted scenes to avoid the annoying vanishing lines.

Share this post

Link to post
Share on other sites

  • 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!