Solution: Drawing tessallated LineLoops in OpenGL/GLSL
I am using OpenGL and GLSL to draw LineLoops on a sphere (Borders on a Planet).
Since the points defining the lines are given by user input they do not have high enough precion to prevent clipping inside the sphere.
I want to use Tesselation and/or Geometry Shaders to create extra points in between existing points so the distance between points does not exceed a certain value (lines no longer clip inside the sphere).
Sadly there is not much information about Tesselation Shaders, so I am not quite sure how they work, but I know that I can subdivide primitives with them.
Here is my current vertexShader:
#version 400
in layout(location = 0) vec3 position;
uniform float maxDist;
uniform float sphereRadius;
uniform mat4 view;
uniform mat4 projection;
void main()
{
gl_Position = projection * view * vec4(position, 1.0);
}
How can I use Tessalation/Geometry Shaders to create more vertices in between points and offset the newly created vertices so they have the given length of the sphereRadius uniform.
I am not looking for a solution that does one subdivision for every line. I look for a solution that does as many subdivisions as needed to get a certain distance between points that does not exceed maxDist.
I am currently drawing like this:
glBindVertexArray(_vao);
glDrawArrays(GL_LINE_LOOP, 0, _size);
glBindVertexArray(0);

