--- libgender/view.C 2004/10/06 05:24:03 1.23 +++ libgender/view.C 2004/10/06 16:19:14 1.30 @@ -1,5 +1,8 @@ #include +#include +#include + #include "oct.h" #include "view.h" @@ -67,6 +70,9 @@ void view::begin () { + glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glDepthRange (0, 1. - (1. / pow (2., 16.))); + vismap.clear (); vislist.clear (); @@ -75,11 +81,13 @@ reset_projection (); // check occlusion queries here +#if 0 for (vector::iterator i = checklist.begin (); i != checklist.end (); ++i) //printf ("%p %d\n", *i, occ_query_result ((*i)->occ_query)); occ_query_result ((*i)->occ_query); checklist.clear (); +#endif world.detect_visibility (*this); } @@ -103,14 +111,12 @@ glDepthFunc (GL_LESS); glDisable (GL_LIGHTING); glColorMask (0, 0, 0, 0); - //cgGLDisableProfile (vsh_profile); + cgGLEnableProfile (vsh_profile);// z-fighting?? cgGLDisableProfile (fsh_profile); } else { -#if 0 glEnable (GL_MINMAX); -#endif glDisable (GL_POLYGON_OFFSET_FILL); glDepthFunc (GL_LESS); glDepthMask (0); @@ -123,8 +129,38 @@ drawn.clear (); + if (mode == view::LIGHTED) + { + glEnable (GL_DEPTH_CLAMP_NV); + glDepthFunc (GL_LESS); + glEnable (GL_COLOR_MATERIAL); + glDisable (GL_LIGHTING); +#if 1 + cgGLDisableProfile (vsh_profile); + cgGLDisableProfile (fsh_profile); +#endif + glShadeModel (GL_FLAT); + + static int count; count++; + if (farlist.size ()) + printf ("%d: size %d\n", count, farlist.size ()); + + for (vector::iterator i = farlist.begin (); i != farlist.end (); ++i) + { + glColor3f (1 / (GLfloat)(i - farlist.begin()), 1, 1 / (GLfloat)(i - farlist.begin())); + (*i)->draw_bbox (*this); + } + + farlist.clear (); + + glEnable (GL_DEPTH_TEST); + glDisable (GL_DEPTH_CLAMP_NV); + glShadeModel (GL_SMOOTH); + } + glColorMask (1, 1, 1, 0); glDepthMask (1); + }