Adjust ground lighting up significantly higher to avoid zbuffer fighting
on cards with 16 bit (or less) depth buffers.
This commit is contained in:
parent
a775392e31
commit
2baba715b4
3 changed files with 15 additions and 2 deletions
|
@ -45,6 +45,7 @@ class FGGeneral {
|
||||||
char *glRenderer;
|
char *glRenderer;
|
||||||
char *glVersion;
|
char *glVersion;
|
||||||
int glMaxTexSize;
|
int glMaxTexSize;
|
||||||
|
int glDepthBits;
|
||||||
|
|
||||||
// Last frame rate measurement
|
// Last frame rate measurement
|
||||||
int frame_rate;
|
int frame_rate;
|
||||||
|
@ -60,6 +61,8 @@ public:
|
||||||
inline void set_glVersion( char *str ) { glVersion = str; }
|
inline void set_glVersion( char *str ) { glVersion = str; }
|
||||||
inline void set_glMaxTexSize( int i ) { glMaxTexSize = i; }
|
inline void set_glMaxTexSize( int i ) { glMaxTexSize = i; }
|
||||||
inline int get_glMaxTexSize() const { return glMaxTexSize; }
|
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; }
|
inline double get_frame_rate() const { return frame_rate; }
|
||||||
#ifdef FANCY_FRAME_COUNTER
|
#ifdef FANCY_FRAME_COUNTER
|
||||||
inline double get_frame(int idx) const { return frames[idx]; }
|
inline double get_frame(int idx) const { return frames[idx]; }
|
||||||
|
|
|
@ -1267,12 +1267,17 @@ int fgGlutInit( int *argc, char **argv ) {
|
||||||
general.set_glVendor( (char *)glGetString ( GL_VENDOR ) );
|
general.set_glVendor( (char *)glGetString ( GL_VENDOR ) );
|
||||||
general.set_glRenderer( (char *)glGetString ( GL_RENDERER ) );
|
general.set_glRenderer( (char *)glGetString ( GL_RENDERER ) );
|
||||||
general.set_glVersion( (char *)glGetString ( GL_VERSION ) );
|
general.set_glVersion( (char *)glGetString ( GL_VERSION ) );
|
||||||
|
FG_LOG( FG_GENERAL, FG_INFO, general.get_glRenderer() );
|
||||||
|
|
||||||
int tmp;
|
int tmp;
|
||||||
glGetIntegerv( GL_MAX_TEXTURE_SIZE, &tmp );
|
glGetIntegerv( GL_MAX_TEXTURE_SIZE, &tmp );
|
||||||
general.set_glMaxTexSize( tmp );
|
general.set_glMaxTexSize( tmp );
|
||||||
FG_LOG ( FG_GENERAL, FG_INFO, general.get_glRenderer() );
|
|
||||||
FG_LOG ( FG_GENERAL, FG_INFO, "Max texture size = " << tmp );
|
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
|
#if 0
|
||||||
// try to determine if we should adjust the initial default
|
// try to determine if we should adjust the initial default
|
||||||
// display resolution. The options class defaults (is
|
// display resolution. The options class defaults (is
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
#include <Aircraft/aircraft.hxx>
|
#include <Aircraft/aircraft.hxx>
|
||||||
|
#include <Include/general.hxx>
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
#include <Scenery/scenery.hxx>
|
#include <Scenery/scenery.hxx>
|
||||||
#include <Time/light.hxx>
|
#include <Time/light.hxx>
|
||||||
|
@ -207,7 +208,11 @@ void FGTileEntry::prep_ssg_node( const Point3D& p, float vis) {
|
||||||
sgCopyVec3( to, sgTrans );
|
sgCopyVec3( to, sgTrans );
|
||||||
double dist = sgLengthVec3( to );
|
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 );
|
sgAddVec3( sgTrans, up );
|
||||||
lights_transform->setTransform( sgTrans );
|
lights_transform->setTransform( sgTrans );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue