]> git.mxchange.org Git - flightgear.git/commitdiff
Additional tweaks to fix the ssg texture (state) problems. Tweaked near
authorcurt <curt>
Mon, 28 Jun 1999 05:47:02 +0000 (05:47 +0000)
committercurt <curt>
Mon, 28 Jun 1999 05:47:02 +0000 (05:47 +0000)
and far clip planes.  Adjusted rendering order so menus and hud get drawn
last.

src/Main/main.cxx
src/Objects/material.hxx
src/Objects/materialmgr.cxx
src/Objects/materialmgr.hxx

index 830abc00135a70fef3b1a87705f08bb298e5445b..8e06130c8f2d88f3bbf3bba8ae0f268ec16a4c14 100644 (file)
@@ -381,26 +381,12 @@ static void fgRenderFrame( void ) {
 
        global_tile_mgr.render();
 
-       xglDisable( GL_TEXTURE_2D );
-       xglDisable( GL_FOG );
-
-       // display HUD && Panel
-       xglDisable( GL_CULL_FACE );
-       fgCockpitUpdate();
-
-       // We can do translucent menus, so why not. :-)
-       xglEnable    ( GL_BLEND ) ;
-       xglBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
-       puDisplay();
-       xglDisable   ( GL_BLEND ) ;
-       xglEnable( GL_FOG );
-
        // ssg test
 
        xglMatrixMode(GL_PROJECTION);
        xglLoadIdentity();
        ssgSetFOV(60.0f, 0.0f);
-       ssgSetNearFar(1.0f, 14000.0f);
+       ssgSetNearFar(10.0f, 14000.0f);
        sgMat4 sgTRANS;
 
        sgMakeTransMat4( sgTRANS, 
@@ -430,6 +416,20 @@ static void fgRenderFrame( void ) {
        // ssgSetCamera( current_view.sgVIEW );
        ssgCullAndDraw( scene );
 
+       xglDisable( GL_TEXTURE_2D );
+       xglDisable( GL_FOG );
+
+       // display HUD && Panel
+       xglDisable( GL_CULL_FACE );
+       fgCockpitUpdate();
+
+       // We can do translucent menus, so why not. :-)
+       xglEnable    ( GL_BLEND ) ;
+       xglBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
+       puDisplay();
+       xglDisable   ( GL_BLEND ) ;
+       xglEnable( GL_FOG );
+
     }
 
     xglutSwapBuffers();
index fff6695e1f72fccc8ffd45ac0fb7044a7324d316..ac103440fb451374edef16f43b7240142ca7d11a 100644 (file)
@@ -88,6 +88,7 @@ public:
 
     inline bool is_loaded() const { return loaded; }
     inline GLuint get_texture_id() const { return texture_id; }
+    inline string get_texture_name() const { return texture_name; }
     inline double get_xsize() const { return xsize; }
     inline double get_ysize() const { return ysize; }
     inline GLfloat *get_ambient() { return ambient; }
index 790b2b273c9f88c7c9c16700ee8a3c5c45830867..ece3f4d65763de2d17ab7a1c045d67ef4cb42f74 100644 (file)
@@ -88,15 +88,6 @@ FGMaterialSlot::render_fragments()
 
        if ( !m.is_loaded() ) {
            m.load_texture( current_options.get_fg_root() );
-
-           // build the ssgSimpleState
-           GLuint tex_id = m.get_texture_id();
-           state.setTexture( tex_id );
-           state.enable( GL_TEXTURE_2D );
-           state.enable( GL_LIGHTING );
-           state.setShadeModel( GL_SMOOTH );
-           state.enable ( GL_CULL_FACE      ) ;
-           state.setMaterial ( GL_AMBIENT_AND_DIFFUSE, 1, 1, 1, 1 ) ;
        }
 
 #ifdef GL_VERSION_1_1
@@ -167,12 +158,24 @@ fgMATERIAL_MGR::load_lib ( void )
            FGMaterial m;
            in >> m;
 
-           // if ( current_options.get_textures() ) {
-           //    m.load_texture( current_options.get_fg_root() );
-           // }
-
            FGMaterialSlot m_slot;
            m_slot.set_m( m );
+
+           // build the ssgSimpleState
+           FGPath tex_file( current_options.get_fg_root() );
+           tex_file.append( "Textures" );
+           tex_file.append( m.get_texture_name() );
+           tex_file.concat( ".rgb" );
+
+           ssgSimpleState *state = new ssgSimpleState;
+           state->setTexture( tex_file.c_str() );
+           state->enable( GL_TEXTURE_2D );
+           state->enable( GL_LIGHTING );
+           state->setShadeModel( GL_SMOOTH );
+           state->enable ( GL_CULL_FACE      ) ;
+           state->setMaterial ( GL_AMBIENT_AND_DIFFUSE, 1, 1, 1, 1 ) ;
+           m_slot.set_state( state );
+
            material_mgr.material_map[material_name] = m_slot;
        }
     }
index 299608dbf537ed882f6dcdb646284225110fcc31..34865eed2b17bf3e6642bd4b73ababb517b25c9c 100644 (file)
@@ -83,7 +83,7 @@ private:
     // size_t list_size;
 
     // ssg stage structure
-    ssgSimpleState state;
+    ssgSimpleState *state;
     bool state_valid;
 
 public:
@@ -115,8 +115,8 @@ public:
     inline void set_m( FGMaterial new_m ) { m = new_m; }
 
     // ssg state
-    inline ssgSimpleState *get_state() { return &state; }
-    inline void set_state( ssgSimpleState s ) { state = s; }
+    inline ssgSimpleState *get_state() { return state; }
+    inline void set_state( ssgSimpleState *s ) { state = s; }
     inline bool get_state_valid() const { return state_valid; }
     inline void set_state_valid( bool flag ) { state_valid = flag; }
 };