]> git.mxchange.org Git - flightgear.git/commitdiff
Adjust ground lighting up significantly higher to avoid zbuffer fighting
authorcurt <curt>
Tue, 5 Dec 2000 14:27:27 +0000 (14:27 +0000)
committercurt <curt>
Tue, 5 Dec 2000 14:27:27 +0000 (14:27 +0000)
on cards with 16 bit (or less) depth buffers.

src/Include/general.hxx
src/Main/main.cxx
src/Scenery/tileentry.cxx

index 9b2eea4d155d78a9274c470ae883cbff5073f774..8a417480e6fb4eb20a0f7b8bca8aad786d4167fa 100644 (file)
@@ -45,6 +45,7 @@ class FGGeneral {
     char *glRenderer;
     char *glVersion;
     int glMaxTexSize;
+    int glDepthBits;
 
     // Last frame rate measurement
     int frame_rate;
@@ -60,6 +61,8 @@ public:
     inline void set_glVersion( char *str ) { glVersion = str; }
     inline void set_glMaxTexSize( int i ) { glMaxTexSize = i; }
     inline int get_glMaxTexSize() const { return glMaxTexSize; }
+    inline void set_glDepthBits( int d ) { glDepthBits = d; }
+    inline int get_glDepthBits() const { return glDepthBits; }
     inline double get_frame_rate() const { return frame_rate; }
 #ifdef FANCY_FRAME_COUNTER
     inline double get_frame(int idx) const { return frames[idx]; }
index 1ff40196a6f7d878ef0eb9a4270c8fe9dbaa8718..2af616382fe5c07b671602dac16c8762dd502401 100644 (file)
@@ -1267,12 +1267,17 @@ int fgGlutInit( int *argc, char **argv ) {
     general.set_glVendor( (char *)glGetString ( GL_VENDOR ) );
     general.set_glRenderer( (char *)glGetString ( GL_RENDERER ) );
     general.set_glVersion( (char *)glGetString ( GL_VERSION ) );
+    FG_LOG( FG_GENERAL, FG_INFO, general.get_glRenderer() );
+
     int tmp;
     glGetIntegerv( GL_MAX_TEXTURE_SIZE, &tmp );
     general.set_glMaxTexSize( tmp );
-    FG_LOG ( FG_GENERAL, FG_INFO, general.get_glRenderer() );
     FG_LOG ( FG_GENERAL, FG_INFO, "Max texture size = " << tmp );
 
+    glGetIntegerv( GL_DEPTH_BITS, &tmp );
+    general.set_glDepthBits( tmp );
+    FG_LOG ( FG_GENERAL, FG_INFO, "Depth buffer bits = " << tmp );
+
 #if 0
     // try to determine if we should adjust the initial default
     // display resolution.  The options class defaults (is
index 5a94eae4c74e71876d8b608480c86a94e227aa97..eacd0ea421f231ee00906620680dbad6c49c262e 100644 (file)
@@ -34,6 +34,7 @@
 #include <simgear/debug/logstream.hxx>
 
 #include <Aircraft/aircraft.hxx>
+#include <Include/general.hxx>
 #include <Main/globals.hxx>
 #include <Scenery/scenery.hxx>
 #include <Time/light.hxx>
@@ -207,7 +208,11 @@ void FGTileEntry::prep_ssg_node( const Point3D& p, float vis) {
        sgCopyVec3( to, sgTrans );
        double dist = sgLengthVec3( to );
 
-       sgScaleVec3( up, 10.0 + agl / 100.0 + dist / 10000 );
+       if ( general.get_glDepthBits() > 16 ) {
+           sgScaleVec3( up, 10.0 + agl / 100.0 + dist / 10000 );
+       } else {
+           sgScaleVec3( up, 10.0 + agl / 20.0 + dist / 5000 );
+       }
        sgAddVec3( sgTrans, up );
        lights_transform->setTransform( sgTrans );