X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fgrits-opengl.c;fp=src%2Fgrits-opengl.c;h=861bfc933a8cd5a38674e926f6df6ebabd456b3f;hp=0e803baf3b5abd6a30e141bde022075254223123;hb=b702b739df3d3dd601b0661c8349810f1fa0e46f;hpb=8941c8e6e06588d43732645e6af3feb959f1eb41 diff --git a/src/grits-opengl.c b/src/grits-opengl.c index 0e803ba..861bfc9 100644 --- a/src/grits-opengl.c +++ b/src/grits-opengl.c @@ -40,6 +40,8 @@ // #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 */ @@ -312,9 +314,10 @@ static void _draw_level(gpointer _level, gpointer _opengl) /* 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 */ @@ -512,6 +515,7 @@ static void grits_opengl_unproject(GritsViewer *_opengl, 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,