Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth line joins #38

Closed
Glusk opened this issue Mar 20, 2019 · 2 comments
Closed

Smooth line joins #38

Glusk opened this issue Mar 20, 2019 · 2 comments

Comments

@Glusk
Copy link
Owner

Glusk commented Mar 20, 2019

libGDX provides no line joining utilities/settings.

Line joins

http://www.bluevoid.com/opengl/sig00/advanced00/notes/node290.html

The following SO answer shows how to compute Milter join points (in general terms, although the question was about libGDX in specific).

An easy round join solution:

Draw a circle centered at the common vertex with radius half the line width. Sounds easy but if not drawn carefully, there would be serious overdraw.

http://artgrammer.blogspot.com/search/label/opengl


If drawing a curve, a texture can be applied to triangle strips. Example:

Texture

https://badlogicgames.com/forum/viewtopic.php?f=11&t=18940 (The forum was shut down).

@Glusk
Copy link
Owner Author

Glusk commented Mar 21, 2019

Update

libGDX renders lines using OpenGL.

One of the sad things about using the OpenGL rendering option in Processing is the lack of control over line weights, caps and joins.

http://www.tom-carden.co.uk/2008/02/09/new-processing-hack-line-caps-and-joins-in-opengl

Unfortunately, drawing lines is a weak point of OpenGL. The GL_LINES drawing mode is limited: it does not support line joins, line caps, non-integer line widths, widths greater than 10px, or varying widths in a single pass.

https://blog.mapbox.com/drawing-antialiased-lines-with-opengl-8766f34192dc

@Glusk
Copy link
Owner Author

Glusk commented Mar 25, 2019

Maybe the simple solution is still good enough:
Draw a circle centered at the common vertex with radius half the line width.

Glusk added a commit that referenced this issue Mar 25, 2019
@Glusk Glusk closed this as completed in #42 Mar 25, 2019
Glusk pushed a commit that referenced this issue Mar 25, 2019
#38 Added round joins polyline drawing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant