X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fsky%2Fmoon.cxx;h=91049ef4b598f1d090b798a01026ab2e29a0176d;hb=f1ab6e2533a1bf07439b3d5918430f496158d8f3;hp=c16e7e871275df351935e9cc63ace12b3f9f2f64;hpb=82459a2802a939434f9fc5b88d2b2aea58f0043d;p=simgear.git diff --git a/simgear/sky/moon.cxx b/simgear/sky/moon.cxx index c16e7e87..91049ef4 100644 --- a/simgear/sky/moon.cxx +++ b/simgear/sky/moon.cxx @@ -29,8 +29,10 @@ # include #endif +#include + #include -#include +#include STL_IOSTREAM #include #include @@ -45,6 +47,13 @@ static int sgMoonOrbPreDraw( ssgEntity *e ) { /* cout << endl << "Moon orb pre draw" << endl << "----------------" << endl << endl; */ + + ssgLeaf *f = (ssgLeaf *)e; + if ( f -> hasState () ) f->getState()->apply() ; + + glPushAttrib( GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT ); + // cout << "push error = " << glGetError() << endl; + glDisable( GL_DEPTH_TEST ); glDisable( GL_FOG ); glBlendFunc ( GL_SRC_ALPHA, GL_ONE ) ; @@ -55,10 +64,13 @@ 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 ); - glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; + // glEnable( GL_DEPTH_TEST ); + // glEnable( GL_FOG ); + // glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; + glPopAttrib(); + // cout << "pop error = " << glGetError() << endl; + /* test glDisable( GL_LIGHTING ); glDisable( GL_CULL_FACE ); @@ -73,6 +85,13 @@ static int sgMoonOrbPostDraw( ssgEntity *e ) { static int sgMoonHaloPreDraw( ssgEntity *e ) { /* cout << endl << "Moon halo pre draw" << endl << "----------------" << endl << endl; */ + + ssgLeaf *f = (ssgLeaf *)e; + if ( f -> hasState () ) f->getState()->apply() ; + + glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_FOG_BIT | GL_COLOR_BUFFER_BIT); + // cout << "push error = " << glGetError() << endl; + glDisable( GL_DEPTH_TEST ); glDisable( GL_FOG ); glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; @@ -83,9 +102,12 @@ 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 ) ; + // glEnable( GL_DEPTH_TEST ); + // glEnable( GL_FOG ); + // glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; + + glPopAttrib(); + // cout << "pop error = " << glGetError() << endl; return true; }