- //glEnable(GL_ALPHA_TEST);
- //glAlphaFunc(GL_EQUAL, 0);
- double scale = 500*1000; // 500 km
- glOrtho(-scale,scale,-scale,scale,0,10000);
+ glClearColor(0.8f, 0.8f, 1.0f, 0.0f);
+
+ /* Tessellation, "finding intersecting triangles" */
+ /* http://research.microsoft.com/pubs/70307/tr-2006-81.pdf */
+ /* http://www.opengl.org/wiki/Alpha_Blending */
+ glAlphaFunc(GL_GREATER,0.1);
+ glEnable(GL_ALPHA_TEST);
+
+ /* Depth test */
+ glClearDepth(1.0);
+ glDepthFunc(GL_LEQUAL);
+ glEnable(GL_DEPTH_TEST);
+
+ /* Perspective */
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ double rad = atan(height/2*1000.0/dist); // 1px = 1000 meters
+ double deg = (rad*180)/M_PI;
+ gluPerspective(deg*2, width/height, dist-20, dist+20);
+
+ /* Camera position? */
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0, 0.0, -dist);
+ //glRotatef(-45, 1, 0, 0);
+