Jump to content
  • Advertisement
Sign in to follow this  
metsfan

OpenGL Issues with lines for OpenGL-based mapping app

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

Hello all, I know this isn't exactly about game dev, but I would really appreciate any assistance on this issue as it does directly relate to OpenGL. I am building an OpenGL-based mapping application for the iPhone. Due to the nature of the application, using GL_LINES is not possible (the lines need to look really good, and I am going to have to employ the very best anti-aliasing techniques, which cannot be done with GL_LINES). Therefore, I am drawing my lines using GL_TRIANGLES (GL_QUADS is not available on the iPhone). I am having an odd issue though.

The application is built using perspective projection. As the user scales the map in and out, I am modifying the view matrix by applying a scale operation. This causes the roads to get closer together or further away as the user scales the map, without modifying the z-coordinates of the triangles being drawn.

The problem I'm having is that as I scale the map very close, the lines appear to "wobble". It's hard to describe but essentially, the lines apear to be getting thinner and thicker, and the actual line segment moving a bit from left to right, but only slightly, causing a strange wobble effect. This issue doesn't seem to happen when scaled out, only when scaled in. My hunch is that it is a precision issue, but I'm wondering if maybe there is another reason why this is happening, or maybe someone could suggest a different technique for drawing the lines altogether.

Thank you.

Share this post


Link to post
Share on other sites
Advertisement
Just wanted to reply and say I was able to resolve the issue by just moving the map along the z-plane, but setting thresholds where the line width would change and reset the lines back to the starting z-position. To put some raw values to it, my near distance is 1 and far distance is 1000. The map is placed at 500 on the z-plane, and moved between 400 and 600. Once it reaches either 400 or 600, the line width is changed to reflect the scaling, and the map is repositioned to 500 on the z-plane. This seems to work for now. I hope this helps someone in the future.

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!