How to Align the Vertex from VS with gl_FragCoord in FS of VTK Shader?

Hi teams,

I’m working with VTK shaders and I have a question regarding passing computed vertex positions from the vertex shader to the fragment shader and aligning them with the gl_FragCoord coordinate system.

In the vertex shader, I compute a vertex position as follows:
“”"

in vs/gs:

vec4 v1 = MCDCMatrix * p (a point in mesh);

in fs:

v1 /= v1/v1.w;
v1= (v1 * +1).xy / 2 + vec2(w, h); // where w and h is setted from cpp code.
“”"
I want to calculate the distance between v1 and gl_fragCoord, but it does not works correctly.

I am unsure of the necessary transformations or adjustments to ensure correct alignment between my computed vertex coordinates and gl_FragCoord.
People familiar with Unity3D told me to use the mvpMatrix, but I can’t find that matrix in VTK.

Any insight or examples would be greatly appreciated!

Thanks!
Best regards.