From: ehofman Date: Sat, 24 Jan 2004 12:08:12 +0000 (+0000) Subject: Clean up the Pre-, and PostDraw functions a bit. Especially the glPushAttrib has... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d97eb240d9c9a6678e43b8b7792a58772f22c12c;p=simgear.git Clean up the Pre-, and PostDraw functions a bit. Especially the glPushAttrib has had some attention. The NVidia hack is commented out for now. --- diff --git a/simgear/scene/sky/moon.cxx b/simgear/scene/sky/moon.cxx index dd280f69..3514f705 100644 --- a/simgear/scene/sky/moon.cxx +++ b/simgear/scene/sky/moon.cxx @@ -48,7 +48,7 @@ static int sgMoonOrbPreDraw( ssgEntity *e ) { ssgLeaf *f = (ssgLeaf *)e; if ( f -> hasState () ) f->getState()->apply() ; - glPushAttrib( GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT ); + glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT ); // cout << "push error = " << glGetError() << endl; glDisable( GL_DEPTH_TEST ); @@ -62,24 +62,14 @@ static int sgMoonOrbPreDraw( ssgEntity *e ) { static int sgMoonOrbPostDraw( ssgEntity *e ) { /* cout << endl << "Moon orb post draw" << endl << "----------------" << endl << endl; */ - // glEnable( GL_DEPTH_TEST ); - // glEnable( GL_FOG ); // Some drivers don't properly reset glBendFunc with a // glPopAttrib() so we reset it to the 'default' here. - glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; + // glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; glPopAttrib(); // cout << "pop error = " << glGetError() << endl; - /* test - glDisable( GL_LIGHTING ); - glDisable( GL_CULL_FACE ); - glEnable( GL_COLOR_MATERIAL ); - glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); - glEnable( GL_CULL_FACE ); - glEnable( GL_LIGHTING ); */ - return true; } @@ -105,9 +95,6 @@ static int sgMoonHaloPreDraw( ssgEntity *e ) { static int sgMoonHaloPostDraw( ssgEntity *e ) { /* cout << endl << "Moon halo post draw" << endl << "----------------" << endl << endl; */ - // glEnable( GL_DEPTH_TEST ); - // glEnable( GL_FOG ); - // glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; glPopAttrib(); // cout << "pop error = " << glGetError() << endl; diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 923ae3f8..9d4794a4 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -73,9 +73,6 @@ static int sgSunOrbPostDraw( ssgEntity *e ) { glPopAttrib(); // cout << "pop error = " << glGetError() << endl; - // glEnable( GL_DEPTH_TEST ); - // glEnable( GL_FOG ); - return true; } @@ -104,9 +101,6 @@ static int sgSunHaloPostDraw( ssgEntity *e ) { glPopAttrib(); // cout << "pop error = " << glGetError() << endl; - // glEnable( GL_DEPTH_TEST ); - // glEnable( GL_FOG ); - return true; } diff --git a/simgear/scene/sky/sky.cxx b/simgear/scene/sky/sky.cxx index fe6bb0ed..1da027a0 100644 --- a/simgear/scene/sky/sky.cxx +++ b/simgear/scene/sky/sky.cxx @@ -175,7 +175,7 @@ void SGSky::preDraw( float alt, float fog_exp2_density ) { // certain NVidia drivers don't seem to implement // glPushAttrib(FG_FOG_BIT) properly. The result is that // there is not fog when looking at the sun. - glFogf ( GL_FOG_DENSITY, fog_exp2_density ); + // glFogf ( GL_FOG_DENSITY, fog_exp2_density ); // if we are closer than this to a cloud layer, don't draw clouds static const float slop = 5.0; diff --git a/simgear/scene/sky/stars.cxx b/simgear/scene/sky/stars.cxx index 023b6baa..47c7f8f1 100644 --- a/simgear/scene/sky/stars.cxx +++ b/simgear/scene/sky/stars.cxx @@ -45,7 +45,7 @@ static int sgStarPreDraw( ssgEntity *e ) { ssgLeaf *f = (ssgLeaf *)e; if ( f -> hasState () ) f->getState()->apply() ; - glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_FOG_BIT ); + glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_FOG_BIT | GL_COLOR_BUFFER_BIT ); glDisable( GL_DEPTH_TEST ); glDisable( GL_FOG ); @@ -60,9 +60,6 @@ static int sgStarPostDraw( ssgEntity *e ) { glPopAttrib(); - // glEnable( GL_DEPTH_TEST ); - // glEnable( GL_FOG ); - return true; }