Additional tweaks to fix the ssg texture (state) problems. Tweaked near
and far clip planes. Adjusted rendering order so menus and hud get drawn last.
This commit is contained in:
parent
858f17b323
commit
aa27214f65
4 changed files with 35 additions and 31 deletions
|
@ -381,26 +381,12 @@ static void fgRenderFrame( void ) {
|
||||||
|
|
||||||
global_tile_mgr.render();
|
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
|
// ssg test
|
||||||
|
|
||||||
xglMatrixMode(GL_PROJECTION);
|
xglMatrixMode(GL_PROJECTION);
|
||||||
xglLoadIdentity();
|
xglLoadIdentity();
|
||||||
ssgSetFOV(60.0f, 0.0f);
|
ssgSetFOV(60.0f, 0.0f);
|
||||||
ssgSetNearFar(1.0f, 14000.0f);
|
ssgSetNearFar(10.0f, 14000.0f);
|
||||||
sgMat4 sgTRANS;
|
sgMat4 sgTRANS;
|
||||||
|
|
||||||
sgMakeTransMat4( sgTRANS,
|
sgMakeTransMat4( sgTRANS,
|
||||||
|
@ -430,6 +416,20 @@ static void fgRenderFrame( void ) {
|
||||||
// ssgSetCamera( current_view.sgVIEW );
|
// ssgSetCamera( current_view.sgVIEW );
|
||||||
ssgCullAndDraw( scene );
|
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();
|
xglutSwapBuffers();
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
|
|
||||||
inline bool is_loaded() const { return loaded; }
|
inline bool is_loaded() const { return loaded; }
|
||||||
inline GLuint get_texture_id() const { return texture_id; }
|
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_xsize() const { return xsize; }
|
||||||
inline double get_ysize() const { return ysize; }
|
inline double get_ysize() const { return ysize; }
|
||||||
inline GLfloat *get_ambient() { return ambient; }
|
inline GLfloat *get_ambient() { return ambient; }
|
||||||
|
|
|
@ -88,15 +88,6 @@ FGMaterialSlot::render_fragments()
|
||||||
|
|
||||||
if ( !m.is_loaded() ) {
|
if ( !m.is_loaded() ) {
|
||||||
m.load_texture( current_options.get_fg_root() );
|
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
|
#ifdef GL_VERSION_1_1
|
||||||
|
@ -167,12 +158,24 @@ fgMATERIAL_MGR::load_lib ( void )
|
||||||
FGMaterial m;
|
FGMaterial m;
|
||||||
in >> m;
|
in >> m;
|
||||||
|
|
||||||
// if ( current_options.get_textures() ) {
|
|
||||||
// m.load_texture( current_options.get_fg_root() );
|
|
||||||
// }
|
|
||||||
|
|
||||||
FGMaterialSlot m_slot;
|
FGMaterialSlot m_slot;
|
||||||
m_slot.set_m( m );
|
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;
|
material_mgr.material_map[material_name] = m_slot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ private:
|
||||||
// size_t list_size;
|
// size_t list_size;
|
||||||
|
|
||||||
// ssg stage structure
|
// ssg stage structure
|
||||||
ssgSimpleState state;
|
ssgSimpleState *state;
|
||||||
bool state_valid;
|
bool state_valid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -115,8 +115,8 @@ public:
|
||||||
inline void set_m( FGMaterial new_m ) { m = new_m; }
|
inline void set_m( FGMaterial new_m ) { m = new_m; }
|
||||||
|
|
||||||
// ssg state
|
// ssg state
|
||||||
inline ssgSimpleState *get_state() { return &state; }
|
inline ssgSimpleState *get_state() { return state; }
|
||||||
inline void set_state( ssgSimpleState s ) { state = s; }
|
inline void set_state( ssgSimpleState *s ) { state = s; }
|
||||||
inline bool get_state_valid() const { return state_valid; }
|
inline bool get_state_valid() const { return state_valid; }
|
||||||
inline void set_state_valid( bool flag ) { state_valid = flag; }
|
inline void set_state_valid( bool flag ) { state_valid = flag; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue