Commits

Cliff Biffle committed 8a7ded8

Point size is now scaled with distance.

Comments (0)

Files changed (2)

   glEnable(GL_CULL_FACE);
   glFrontFace(GL_CCW);
   glShadeModel(GL_SMOOTH);
-  
+  glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+  glEnable(GL_POINT_SMOOTH);
+
   GLfloat diffuseColor[4] = { 1.f, 1.f, 1.f, 1.0f };
   glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseColor);
 
   
   if (vertex.z <= 0.) {
     gl_FrontColor = vec4(0,0,0,0);
+    gl_PointSize = 0.;
+    return;
   } else {
     gl_FrontColor = light_vertex(normal);
   }
+  
+  vec4 vertexInEye = gl_ModelViewMatrix * vertex;
+	float dist = distance(vertexInEye.xyz, vec3(0,0,0));
+	float psize = clamp(1.5 / dist, gl_Point.sizeMin + 1., gl_Point.sizeMax);
+	gl_PointSize = psize;
 }