]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sky/moon.cxx
Patch from Melchior Franz:
[simgear.git] / simgear / sky / moon.cxx
index c5310fd4b88c38fdb79126223f9bc57950b42cd3..f5c81b3b6928ae5717c58040921cb1a71b41f218 100644 (file)
 // $Id$
 
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
+#include <simgear/compiler.h>
 
 #include <stdio.h>
-#include <iostream>
+#include STL_IOSTREAM
 
 #include <plib/sg.h>
 #include <plib/ssg.h>
@@ -59,12 +57,16 @@ static int sgMoonOrbPreDraw( ssgEntity *e ) {
     return true;
 }
 
+
 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 ) ;
+
+    // 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 ) ;
 
     glPopAttrib();
     // cout << "pop error = " << glGetError() << endl;
@@ -80,6 +82,8 @@ static int sgMoonOrbPostDraw( ssgEntity *e ) {
     return true;
 }
 
+
+#if 0
 static int sgMoonHaloPreDraw( ssgEntity *e ) {
     /* cout << endl << "Moon halo pre draw" << endl << "----------------" 
         << endl << endl; */
@@ -88,7 +92,7 @@ static int sgMoonHaloPreDraw( ssgEntity *e ) {
     if ( f -> hasState () ) f->getState()->apply() ;
 
     glPushAttrib( GL_DEPTH_BUFFER_BIT | GL_FOG_BIT | GL_COLOR_BUFFER_BIT);
-    cout << "push error = " << glGetError() << endl;
+    // cout << "push error = " << glGetError() << endl;
 
     glDisable( GL_DEPTH_TEST );
     glDisable( GL_FOG );
@@ -105,10 +109,11 @@ static int sgMoonHaloPostDraw( ssgEntity *e ) {
     // glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
     
     glPopAttrib();
-    cout << "pop error = " << glGetError() << endl;
+    // cout << "pop error = " << glGetError() << endl;
 
     return true;
 }
+#endif
 
 
 // Constructor
@@ -122,7 +127,7 @@ SGMoon::~SGMoon( void ) {
 
 
 // build the moon object
-ssgBranch * SGMoon::build( FGPath path, double moon_size ) {
+ssgBranch * SGMoon::build( SGPath path, double moon_size ) {
 
     // set up the orb state
     path.append( "moon.rgba" );