From: ehofman Date: Fri, 15 Aug 2003 17:19:22 +0000 (+0000) Subject: Add support for NVidia cards with a broken OpenGL implementation X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=93b747f1bab05b12034160c4c2b23fc08e1866b9;p=simgear.git Add support for NVidia cards with a broken OpenGL implementation --- diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 2024cbe1..034676dc 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -49,6 +49,14 @@ #include "sphere.hxx" #include "oursun.hxx" +// FIXME: This should not be needed, but at this time (08/15/2003) +// certain NVidia drivers don't seem to implement +// fgPushAttrib(FG_FOG_BIT) properly. The result is that +// there is not fog when looking at the sun. +#ifndef SG_PROPER_FOG_SUPPORT +static float curFogDensity; +#endif + // Set up sun rendering call backs static int sgSunOrbPreDraw( ssgEntity *e ) { @@ -87,6 +95,10 @@ static int sgSunHaloPreDraw( ssgEntity *e ) { ssgLeaf *f = (ssgLeaf *)e; if ( f -> hasState () ) f->getState()->apply() ; +#ifndef SG_PROPER_FOG_SUPPORT + glGetFloatv( GL_FOG_DENSITY, &curFogDensity ); +#endif + glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_FOG_BIT ); // cout << "push error = " << glGetError() << endl; @@ -105,6 +117,10 @@ static int sgSunHaloPostDraw( ssgEntity *e ) { glPopAttrib(); // cout << "pop error = " << glGetError() << endl; +#ifndef SG_PROPER_FOG_SUPPORT + glFogf( GL_FOG_DENSITY, curFogDensity ); +#endif + // glEnable( GL_DEPTH_TEST ); // glEnable( GL_FOG );