Jump to content
  • Advertisement
Sign in to follow this  
BobTheFish

Many evenly spaced vertical lines form a sine wave?

This topic is 4832 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 using ortho view, and I'm placing vertical lines in such a manner, where the floats snap and timelength are constant throughout the routine, they're just contextual:
glColor3f(0.0f, 0.0f, 0.0f);
glEnable(GL_LINE_WIDTH);
glLineWidth(1.0f);

glBegin(GL_LINES);

 glVertex2f(20.0f, 672.0f);
 glVertex2f(1004.0f, 672.0f);
 
 for (float snplp=snap; snplp<timelength; snplp+=snap)
 {
  glVertex2f(snplp, 670.0f);
  glVertex2f(snplp, 677.0f);
 }

glEnd();
The result (I've zoomed 2x to show the effect easier). At first I thought it was just an optical illusion, but it's not. I'm giving all the lines the same top and bottom y values, so I have to say it was a little surprising to see them at different y values. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Ravuya
Might be a float precision problem.

I'm thinking it might be when the geometry is mapped onto the screen - try setting the viewport to the size of the window (in pixels) and see if that makes any difference.

Share this post


Link to post
Share on other sites
Quote:
try setting the viewport to the size of the window (in pixels)

It already is, sad to say.

-EDIT- My bad. It wasn't. My viewport height was set to 767 and the window height to 768.

Although it fixed it in this case, it's not a complete solution for me because I want users to be able to change window size. Oh well, I guess I'll just use the quads. Thanks for your help :)

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.

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!