Clean up the Pre-, and PostDraw functions a bit. Especially the glPushAttrib has had some attention. The NVidia hack is commented out for now.

This commit is contained in:
ehofman
2004-01-24 12:08:12 +00:00
parent 8c296d96c7
commit d97eb240d9
4 changed files with 4 additions and 26 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}