Source

kinect-viewer / main.vs

Diff from to

File main.vs

  */
 void main() {
   vec4 vertex = kinect_unproject(depthTex, gl_Vertex);
-  
+  vec4 eyeVertex = gl_ModelViewMatrix * vertex;
   // Project the point using GL's perspective settings.
-  gl_Position = gl_ModelViewProjectionMatrix * vertex;
+  gl_Position = gl_ProjectionMatrix * eyeVertex;
   
   // Calculate the vertex normal in Kinect-camera space.
   vec4 rightVertex = kinect_unproject(depthTex, gl_Vertex + vec4(pixelDistanceX, 0, 0, 0));
   } else {
     gl_FrontColor = gl_Color;
   }
+  
+  vec3 eyeVertex3 = eyeVertex.xyz / eyeVertex.w;
+  float distance = -eyeVertex3.z;
+  float baseSize = vertex3.z * 1.9;
+  gl_PointSize = baseSize / (distance);
 }