You could go with a 3D quad and just send x1,y1,z1 and x2,y2,z2 to a shader that is applied to it and set the vertex positions accordingly.
Based on the uv coords it's easy to know which vertex belongs to which end.
You can also calculate the perpendicular vector to the plane that the view vector and the line direction build and use that to add thickness to the line object. This way the thickness offset will always rotate with your cam view and you don't get ultra thin lines from certain angles.
The thickness is ofcourse set in 3D world space, so it will vary with the perspective (a true 3D line object). But if you are debugging linepicks that's a good thing I guess, makes it easier to immediately see where the line is in 3D space.
Sidenote: If you want to have non 3D distance reliant thickness, you can move the thickness part to after the ViewProj transform. If you take the line direction to clip space too, it should be simple to do a 90 degree 2D rotation to get the thickness offset direction.
Here is a simple shader that you can use as starting point. Make sure the quad you use has UVs set to 0,0 to 1,1. (so basically what any 3D app will set as default anyway)
Vertex shader:
attribute vec3 position;
attribute mediump vec2 uv;
uniform mat4 agk_ViewProj;
uniform vec3 agk_CameraPos;
uniform vec4 pos1;
uniform vec4 pos2;
uniform float thickness;
void main(){
vec4 pos = vec4(mix(pos1.xyz,pos2.xyz,step(0.5,uv.x)),1);
pos.xyz += cross(normalize(agk_CameraPos-pos.xyz),normalize(pos2.xyz-pos1.xyz))*thickness*uv.y;
gl_Position = agk_ViewProj * pos;
}
Basically, the first line in the main vertex shader function sets each pair of vertices to the appropiate end points of the line, then line 2 adds some thickness.
For the pixel shader you can just use the simplest pixel shader of all times and write out a color of your choice (which can also be set from AppGameKit code)
uniform vec3 col;
void main() {
gl_FragColor = vec4(col, 1);
}
To set the end points and thickness from AGK:
SetShaderConstantByName(shaderID, "pos1", x1, y1, z1, 0)
SetShaderConstantByName(shaderID, "pos2", x2, y2, z2, 0)
SetShaderConstantByName(shaderID, "thickness", thickness, 0,0,0)
I just quickly threw it together, could be improved a lot!
But it seems to work, I added it to a random test scene and had no issues. (screens attached)