1
0
Fork 0

More tweaks to opengl state management when drawing 3d clouds.

This commit is contained in:
curt 2002-09-23 22:05:36 +00:00
parent 7c057de4fe
commit 43af8026d8

View file

@ -470,8 +470,23 @@ void fgRenderFrame() {
fgReshape( fgGetInt("/sim/startup/xsize"),
fgGetInt("/sim/startup/ysize") );
// set the sun position (done later with ssg calls)
// glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
if ( fgGetBool("/sim/rendering/clouds3d") ) {
glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
cloud3d_imposter_state->force();
glDisable( GL_FOG );
glColor4f( 1.0, 1.0, 1.0, 1.0 );
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) ;
if ( _bcloud_orig ) {
Point3D c = globals->get_scenery()->get_center();
sgClouds3d->Set_Cloud_Orig( &c );
_bcloud_orig = false;
}
sgClouds3d->Update( current__view->get_absolute_view_pos() );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
glDisable(GL_DEPTH_TEST);
}
clear_mask = GL_DEPTH_BUFFER_BIT;
if ( fgGetBool("/sim/rendering/wireframe") ) {
@ -492,21 +507,6 @@ void fgRenderFrame() {
}
glClear( clear_mask );
if ( fgGetBool("/sim/rendering/clouds3d") ) {
cloud3d_imposter_state->force();
glDisable( GL_FOG );
glColor4f( 1.0, 1.0, 1.0, 1.0 );
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) ;
if ( _bcloud_orig ) {
Point3D c = globals->get_scenery()->get_center();
sgClouds3d->Set_Cloud_Orig( &c );
_bcloud_orig = false;
}
sgClouds3d->Update( current__view->get_absolute_view_pos() );
}
// Tell GL we are switching to model view parameters
// I really should create a derived ssg node or use a call
@ -777,16 +777,13 @@ void fgRenderFrame() {
if ( fgGetBool("/sim/rendering/clouds3d") ) {
glDisable( GL_FOG );
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glBlendFunc ( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) ;
glDisable( GL_DEPTH_TEST );
glDisable( GL_LIGHTING );
// cout << "drawing new clouds" << endl;
// set the opengl state to known default values
// default_state->force();
sgClouds3d->Draw((sgVec4 *)current__view->get_VIEW());
glEnable( GL_FOG );
glEnable( GL_LIGHTING );
glEnable( GL_DEPTH_TEST );
glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ;
}
globals->get_model_mgr()->draw();