Jump to content

  • Log In with Google      Sign In   
  • Create Account


Rotating Line Strips in OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 drstrangeluv   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 December 1999 - 08:04 AM

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?

Thanks.


Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 22 December 1999 - 08:04 AM

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);
glColorfv(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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS