Need advice about a specific gfx technique

Hey

So ive been playing around with making a basic strategy game using LibGDX, and so far ive just been using basic Shaperenderer Lines to represent paths in a visual way for the player.

It looks really bad, im aware that Shaperenderer is really just a debugging tool more than anything, so I started looking at some games I own and how they show paths.

Look below at two games that use the technique I would like to use.

How would you go about making this exact kind of thing? Would you use a Mesh?

Divided We Fall

Hearts Of Iron 4

The steps in the image correlate to the steps below.

  1. You could start with a curve defined by your start/intermediate/end points.
    https://github.com/libgdx/libgdx/wiki/Path-interface-%26-Splines

  2. Sample a sufficiently dense set of points from that curve.

  3. Extrude points sideways along the (average of 2 touching lines) normal vector of the lines and throw your initial curve and sampled point set away.
    You now have the vertices to form the mesh for the curve that gets rendered.

  4. You now need to build the indices and UV coordinates to make the mesh complete.

  5. Generate the tip of the arrow-curve, the tip can be pre-defined and just rotated and glued onto the end of the curve.

[The uv-coordinates are the same for every segment of your curve, except the arrow, you need two areas on your texture => segment and tip]

  1. Throw it at opengl with some overlay render mode.

I’m pretty sure there’s some kind of tutorial on this already, maybe even finished code from some other project.

Thanks for the break down, thats really helpful

I actually posted the same question on the Libgdx site and someone posted a good link:

http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=26006