1
0
Fork 0

Added ref() count increment calls to all ssgSimpleState creation to prevent

them from being delete by ssg once nothing in the scene graph points to them.
This commit is contained in:
curt 2000-10-18 00:48:12 +00:00
parent d4194eea12
commit 806511bd99
2 changed files with 9 additions and 0 deletions

View file

@ -199,6 +199,7 @@ ssgSimpleState *menus;
void fgBuildRenderStates( void ) { void fgBuildRenderStates( void ) {
default_state = new ssgSimpleState; default_state = new ssgSimpleState;
default_state->ref();
default_state->disable( GL_TEXTURE_2D ); default_state->disable( GL_TEXTURE_2D );
default_state->enable( GL_CULL_FACE ); default_state->enable( GL_CULL_FACE );
default_state->enable( GL_COLOR_MATERIAL ); default_state->enable( GL_COLOR_MATERIAL );
@ -210,12 +211,14 @@ void fgBuildRenderStates( void ) {
default_state->disable( GL_LIGHTING ); default_state->disable( GL_LIGHTING );
hud_and_panel = new ssgSimpleState; hud_and_panel = new ssgSimpleState;
hud_and_panel->ref();
hud_and_panel->disable( GL_CULL_FACE ); hud_and_panel->disable( GL_CULL_FACE );
hud_and_panel->disable( GL_TEXTURE_2D ); hud_and_panel->disable( GL_TEXTURE_2D );
hud_and_panel->disable( GL_LIGHTING ); hud_and_panel->disable( GL_LIGHTING );
hud_and_panel->enable( GL_BLEND ); hud_and_panel->enable( GL_BLEND );
menus = new ssgSimpleState; menus = new ssgSimpleState;
menus->ref();
menus->disable( GL_CULL_FACE ); menus->disable( GL_CULL_FACE );
menus->disable( GL_TEXTURE_2D ); menus->disable( GL_TEXTURE_2D );
menus->enable( GL_BLEND ); menus->enable( GL_BLEND );

View file

@ -75,8 +75,12 @@ void FGNewMat::build_ssg_state( const string& path,
tex_file.append( texture_name ); tex_file.append( texture_name );
state = new ssgStateSelector(2); state = new ssgStateSelector(2);
textured = new ssgSimpleState(); textured = new ssgSimpleState();
textured->ref();
nontextured = new ssgSimpleState(); nontextured = new ssgSimpleState();
nontextured->ref();
// Set up the textured state // Set up the textured state
textured->setShadeModel( shade_model ); textured->setShadeModel( shade_model );
@ -130,7 +134,9 @@ void FGNewMat::build_ssg_state( const string& path,
void FGNewMat::set_ssg_state( ssgSimpleState *s ) { void FGNewMat::set_ssg_state( ssgSimpleState *s ) {
state = new ssgStateSelector(2); state = new ssgStateSelector(2);
textured = s; textured = s;
nontextured = new ssgSimpleState(); nontextured = new ssgSimpleState();
nontextured->ref();
// Set up the coloured state // Set up the coloured state
nontextured->enable( GL_LIGHTING ); nontextured->enable( GL_LIGHTING );