Why do we still have to use gl_Position in vertex shaders instead of a user-defined output variable? In a fragment shader, gl_FragColor can be (has to be?) replaced by a custom variable as well…
maybe it’s because there can be several outputs from a vertex shader to a geometry/fragment one and the underlying source needs to know which one is the vertex position?
gl_Position is not just one of the gl variables with perspective interpolation. It is a special variable that points GL rasterizer to the area it needs to process.
I see only one case which doesn’t require gl_Position - the transform feedback with GL_RASTERIZER_DISCARD.