Geometry Shaders: Need help with identifying points in a line.

Starting from today i stumbled across this uncommon and niche problem to which i couldn’t find my answers to : How i can identify points of a line in geometry shader and apply drawing command on that particular point ?
For example every line has two points let’s call them p1 (starting point) and p2 (ending point) how can I identify p2 in geometry shader and execute shader’s drawing commands only to p2 and not to both without making a whole new VBO for a point ?

examplary code

layout (lines) in;
layout (line_strip) out;
layout (max_vertices = 2) out;

void main()
	gl_Position = gl_in[1].gl_Position + vec4(-0.1, 0.0, 0.0, 0.0);

    gl_Position = gl_in[1].gl_Position + vec4(0.1, 0.0, 0.0, 0.0);


And yes i tried changing gl_in array number and it still doesn’t work.

how can I identify p2 in geometry shader and execute shader’s drawing commands only to p2 and not to both

That’s not how geometry shaders work.

A Geometry Shader executes on a primitive, not on a vertex. So unless the primitive type is “point”, there’s no way for a GS to execute on a single point.

Now, a geometry shader can ignore one of the vertices of the input primitive; the vertices it outputs can be computed however it wishes. But since you haven’t told us what “doesn’t work” about your code, or what space gl_in[1].gl_Position is in such that adding/subtracting 0.1 from the X coordinate is a reasonable thing, there’s no much we can do to help you.

@Alfonse Reinheart

Thank you for your response.

It seems that worst of my exceptations came true,the problem is that i am creating 2D Real Time Fractal Engine and as I planned, I had to make it compatible with many different fractal Objects and as it seems they would have different shaders each.
for example I have an 2D fractal Tree which is the object named Tree1(depth,angle,point1,point2,multiplier) and as I planned i thought that i am going to use Transform Feedback with geometry shaders to Calculate and draw next depth points which are point3 left and point 3 right.

And if you are asking point 3 = (point2 - point1) * multiplier;

I think that maybe it would work with compute shaders.

I think that i am going to make a separate thread to adress many questions and problems which i’ve encountered while making this project.