ssgSelector *penguin_sel = NULL;
ssgTransform *penguin_pos = NULL;
+// hack
+sgMat4 copy_of_ssgOpenGLAxisSwapMatrix =
+{
+ { 1.0f, 0.0f, 0.0f, 0.0f },
+ { 0.0f, 0.0f, -1.0f, 0.0f },
+ { 0.0f, 1.0f, 0.0f, 0.0f },
+ { 0.0f, 0.0f, 0.0f, 1.0f }
+} ;
// The following defines flight gear options. Because glutlib will also
// want to parse its own options, those options must not be included here
}
-#if 0
-// Draw a basic instrument panel
-static void fgUpdateInstrViewParams( void ) {
-
- exit(0);
-
- fgVIEW *v = ¤t_view;
-
- xglViewport(0, 0 , (GLint)(v->winWidth), (GLint)(v->winHeight) / 2);
-
- xglMatrixMode(GL_PROJECTION);
- xglPushMatrix();
-
- xglLoadIdentity();
- gluOrtho2D(0, 640, 0, 480);
- xglMatrixMode(GL_MODELVIEW);
- xglPushMatrix();
- xglLoadIdentity();
-
- xglColor3f(1.0, 1.0, 1.0);
- xglIndexi(7);
-
- xglDisable(GL_DEPTH_TEST);
- xglDisable(GL_LIGHTING);
-
- xglLineWidth(1);
- xglColor3f (0.5, 0.5, 0.5);
-
- xglBegin(GL_QUADS);
- xglVertex2f(0.0, 0.00);
- xglVertex2f(0.0, 480.0);
- xglVertex2f(640.0,480.0);
- xglVertex2f(640.0, 0.0);
- xglEnd();
-
- xglRectf(0.0,0.0, 640, 480);
- xglEnable(GL_DEPTH_TEST);
- xglEnable(GL_LIGHTING);
- xglMatrixMode(GL_PROJECTION);
- xglPopMatrix();
- xglMatrixMode(GL_MODELVIEW);
- xglPopMatrix();
-}
-#endif
-
-
// Update all Visuals (redraws anything graphics related)
static void fgRenderFrame( void ) {
fgLIGHT *l = &cur_light_params;
xglClear( clear_mask );
// Tell GL we are switching to model view parameters
+
+ // I really should create a derived ssg node or use a call
+ // back or something so that I can draw the sky within the
+ // ssgCullandDraw() function, but for now I just mimic what
+ // ssg does to set up the model view matrix
xglMatrixMode(GL_MODELVIEW);
- // xglLoadIdentity();
+ xglLoadIdentity();
+ sgMat4 vm_tmp, view_mat;
+ sgTransposeNegateMat4 ( vm_tmp, v->sgVIEW ) ;
+ sgCopyMat4( view_mat, copy_of_ssgOpenGLAxisSwapMatrix ) ;
+ sgPreMultMat4( view_mat, vm_tmp ) ;
+ xglLoadMatrixf( (float *)view_mat );
// draw sky
xglDisable( GL_DEPTH_TEST );
// ssg test
- xglMatrixMode( GL_PROJECTION );
- xglLoadIdentity();
+ // xglMatrixMode( GL_PROJECTION );
+ // xglLoadIdentity();
ssgSetFOV( current_options.get_fov(), 0.0f );
double agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
// Handle new window size or exposure
void fgReshape( int width, int height ) {
if ( ! current_options.get_panel_status() ) {
- current_view.set_win_ratio( (GLfloat) width / (GLfloat) height );
- xglViewport(0, 0 , (GLint)(width), (GLint)(height) );
+ // current_view.set_win_ratio( (GLfloat) width / (GLfloat) height );
+ // xglViewport(0, 0 , (GLint)(width), (GLint)(height) );
} else {
- current_view.set_win_ratio( (GLfloat) width /
- ((GLfloat) (height)*0.4232) );
- xglViewport(0, (GLint)((height)*0.5768), (GLint)(width),
- (GLint)((height)*0.4232) );
+ // current_view.set_win_ratio( (GLfloat) width /
+ // ((GLfloat) (height)*0.4232) );
+ // xglViewport(0, (GLint)((height)*0.5768), (GLint)(width),
+ // (GLint)((height)*0.4232) );
}
current_view.set_winWidth( width );
}
-#ifdef 0
+#if 0
// Basically, this is a modified version of the Mesa gluLookAt()
// function that's been modified slightly so we can capture the
// result before sending it off to OpenGL land.
}
if ( ! current_options.get_panel_status() ) {
- xglViewport(0, 0 , (GLint)(winWidth), (GLint)(winHeight) );
+ // xglViewport(0, 0 , (GLint)(winWidth), (GLint)(winHeight) );
} else {
- xglViewport(0, (GLint)((winHeight)*0.5768), (GLint)(winWidth),
- (GLint)((winHeight)*0.4232) );
+ // xglViewport(0, (GLint)((winHeight)*0.5768), (GLint)(winWidth),
+ // (GLint)((winHeight)*0.4232) );
}
// Tell GL we are about to modify the projection parameters
- xglMatrixMode(GL_PROJECTION);
- xglLoadIdentity();
+ // xglMatrixMode(GL_PROJECTION);
+ // xglLoadIdentity();
if ( f->get_Altitude() * FEET_TO_METER - scenery.cur_elev > 10.0 ) {
// ssgSetNearFar( 10.0, 100000.0 );
- gluPerspective(current_options.get_fov(), win_ratio, 10.0, 100000.0);
+ // gluPerspective(current_options.get_fov(), win_ratio, 10.0, 100000.0);
} else {
// ssgSetNearFar( 0.5, 100000.0 );
- gluPerspective(current_options.get_fov(), win_ratio, 0.5, 100000.0);
+ // gluPerspective(current_options.get_fov(), win_ratio, 0.5, 100000.0);
// printf("Near ground, minimizing near clip plane\n");
}
// }
- xglMatrixMode(GL_MODELVIEW);
- xglLoadIdentity();
+ // xglMatrixMode(GL_MODELVIEW);
+ // xglLoadIdentity();
// set up our view volume (default)
#if !defined(FG_VIEW_INLINE_OPTIMIZATIONS)
- LookAt(view_pos.x(), view_pos.y(), view_pos.z(),
+ /* LookAt(view_pos.x(), view_pos.y(), view_pos.z(),
view_pos.x() + view_forward[0],
view_pos.y() + view_forward[1],
view_pos.z() + view_forward[2],
- view_up[0], view_up[1], view_up[2]);
+ view_up[0], view_up[1], view_up[2]); */
// look almost straight up (testing and eclipse watching)
/* LookAt(view_pos.x(), view_pos.y(), view_pos.z(),
m[15] = 1.0 /* m[3] * -view_pos.x() + m[7] * -view_pos.y() + m[11] * -view_pos.z() + m[15] */;
// xglMultMatrixd( m );
- xglLoadMatrixf( m );
+ // xglLoadMatrixf( m );
}
#endif // FG_VIEW_INLINE_OPTIMIZATIONS