X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCockpit%2Fpanel.cxx;h=7c7dd810c690e1f21119b43f8657453db7046f5f;hb=2ba4f3ddad94c6045160663578b66bb573fd05ac;hp=e2caa87f0cc1d0bd963f7d34422e4e2e3dfb389f;hpb=e503591af4f16814d78ded49c5979e273d81a0be;p=flightgear.git diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index e2caa87f0..7c7dd810c 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -60,9 +61,6 @@ #include
#include -#include "hud.hxx" - - #define WIN_X 0 #define WIN_Y 0 #define WIN_W 1024 @@ -122,11 +120,7 @@ FGTextureManager::createTexture (const string &relativePath, bool staticTexture) { osg::Texture2D* texture = _textureMap[relativePath].get(); if (texture == 0) { - SG_LOG( SG_COCKPIT, SG_DEBUG, - "Texture " << relativePath << " does not yet exist" ); - SGPath tpath(globals->get_fg_root()); - tpath.append(relativePath); - + SGPath tpath = globals->resolve_aircraft_path(relativePath); texture = SGLoadTexture2D(staticTexture, tpath); _textureMap[relativePath] = texture; @@ -277,6 +271,7 @@ FGPanel::update (double dt) void FGPanel::update (osg::State& state, GLfloat winx, GLfloat winw, GLfloat winy, GLfloat winh) { + using namespace osg; // Calculate accelerations // and jiggle the panel accordingly // The factors and bounds are just @@ -288,12 +283,13 @@ FGPanel::update (osg::State& state, GLfloat winx, GLfloat winw, GLfloat winy, GL glMatrixMode(GL_PROJECTION); glPushMatrix(); - glLoadIdentity(); + Matrixf proj; if ( _flipx->getBoolValue() ) { - gluOrtho2D(winx + winw, winx, winy + winh, winy); /* up side down */ + proj = Matrixf::ortho2D(winx + winw, winx, winy + winh, winy); /* up side down */ } else { - gluOrtho2D(winx, winx + winw, winy, winy + winh); /* right side up */ + proj = Matrixf::ortho2D(winx, winx + winw, winy, winy + winh); /* right side up */ } + glLoadMatrix(proj.ptr()); glMatrixMode(GL_MODELVIEW); glPushMatrix(); @@ -1109,7 +1105,12 @@ FGTextLayer::draw (osg::State& state) transform(); FGFontCache *fc = globals->get_fontcache(); - text_renderer.setFont(fc->getTexFont(_font_name.c_str())); + fntFont* font = fc->getTexFont(_font_name.c_str()); + if (!font) { + return; // don't crash on missing fonts + } + + text_renderer.setFont(font); text_renderer.setPointSize(_pointSize); text_renderer.begin(); @@ -1170,6 +1171,11 @@ void FGTextLayer::setFontName(const string &name) { _font_name = name + ".txf"; + FGFontCache *fc = globals->get_fontcache(); + fntFont* font = fc->getTexFont(_font_name.c_str()); + if (!font) { + SG_LOG(SG_GENERAL, SG_WARN, "unable to find font:" << name); + } }