// #define ROAM_DEBUG
+#define OVERLAY_SLICE 0.01
+
/* Tessellation, "finding intersecting triangles" */
/* http://research.microsoft.com/pubs/70307/tr-2006-81.pdf */
/* http://www.opengl.org/wiki/Alpha_Blending */
/* Enable depth and alpha for world levels */
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.1);
+ glDepthRange(OVERLAY_SLICE, 1);
} else {
- /* Disable depth for Overlay/HUD levels */
- glDepthMask(FALSE);
+ /* Draw overlay in front of world */
+ glDepthRange(0, OVERLAY_SLICE);
}
/* Start ortho */
glReadPixels(px, py, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &tmp);
pz = tmp;
}
+ pz = (pz-OVERLAY_SLICE) * (1.0/(1-OVERLAY_SLICE));
gluUnProject(px, py, pz,
opengl->sphere->view->model,
opengl->sphere->view->proj,
/* Add compass */
GritsCallback *compass = grits_callback_new(compass_expose, env);
- grits_viewer_add(viewer, GRITS_OBJECT(compass), GRITS_LEVEL_HUD, FALSE);
+ grits_viewer_add(viewer, GRITS_OBJECT(compass), GRITS_LEVEL_HUD, TRUE);
g_signal_connect(compass, "clicked", G_CALLBACK(compass_click), viewer);
grits_object_set_cursor(GRITS_OBJECT(compass), GDK_CROSS);
env->refs = g_list_prepend(env->refs, compass);