nuclear@21: uniform vec2 viewport; nuclear@21: nuclear@21: void main() nuclear@21: { nuclear@21: const float psize = 1.0; nuclear@21: nuclear@21: vec4 ppos = gl_ModelViewProjectionMatrix * gl_Vertex; nuclear@21: gl_Position = ppos; nuclear@21: nuclear@21: float vs_z = (gl_ModelViewMatrix * gl_Vertex).z; nuclear@21: vec4 p0 = gl_ProjectionMatrix * vec4(0.0, 0.0, vs_z, 1.0); nuclear@21: vec4 p1 = gl_ProjectionMatrix * vec4(psize, 0.0, vs_z, 1.0); nuclear@21: nuclear@21: p0.xyz /= p0.w; nuclear@21: p1.xyz /= p1.w; nuclear@21: nuclear@21: p0.xy = (p0.xy * vec2(0.5, 0.5) + vec2(0.5, 0.5)) * viewport; nuclear@21: p1.xy = (p1.xy * vec2(0.5, 0.5) + vec2(0.5, 0.5)) * viewport; nuclear@21: nuclear@21: float sz = length(p1.xy - p0.xy); nuclear@21: gl_PointSize = sz; nuclear@21: }