Jump to content
  • Advertisement
Sign in to follow this  
legionalways

OpenGL How to draw a smooth line in "classical OpenGL"

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

Hi all,I got only a handful of vertices and I want to draw a smooth and curved line as google map draws its rivers.
Yeah, I want to draw a river on the map. For now, I use GL_LINE_STRIP, but the visual result is not that good.
(It looks as if some line segments are pieced together)

what are your ways?

Share this post


Link to post
Share on other sites
Advertisement

Hi all,I got only a handful of vertices and I want to draw a smooth and curved line as google map draws its rivers.
Yeah, I want to draw a river on the map. For now, I use GL_LINE_STRIP, but the visual result is not that good.
(It looks as if some line segments are pieced together)

what are your ways?


The title of this thread asks how to draw a smooth line, which implies usage of AA, and it is quite different thing than you want to achieve. Drawing a curved line instead of polygonal one is totally different thing. As OpenGL can't draw curved line you have to tessellate your polygon line so that it appears to be curved. You can do it on your own, or use some (deprecated) approach of legacy OpenGL. If you chose the second solution, I would suggest you to read chapter 12 - Evaluators and NURBS from the Red Book.

Share this post


Link to post
Share on other sites
You can look at my library. It has glhEvaluateCatmullRomCurvef which produces some nice curves.
//PURPOSE: This function computes a k-th Order Catmull-Rom Spline. // Typically, the Catmull-Rom functions are limited to 4 points : P0, P1, P2, P3 // and also, you vary a variable called t from 0.0 to 1.0 and you get a curve from P1 to P2. // This function doesn't have such limitations. // You can supply any number of points. // The curve is generated *starting* from the first control point *until* the last control point. [/quote]

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!