- char *mesa_win_state;
-
- // Initialize PUI
-#ifndef PU_USE_NONE
- puInit();
-#endif
- puSetDefaultStyle ( PUSTYLE_SMALL_SHADED ); //PUSTYLE_DEFAULT
- puSetDefaultColourScheme (0.8, 0.8, 0.9, 1);
-
- FGFontCache *fc = globals->get_fontcache();
- puFont *GuiFont = fc->get(globals->get_locale()->getStringValue("font", "typewriter.txf"), 15);
- puSetDefaultFonts(*GuiFont, *GuiFont);
- guiFnt = puGetDefaultLabelFont();
-
- LayoutWidget::setDefaultFont(GuiFont, 15);
+class GUIInitOperation : public GraphicsContextOperation
+{
+public:
+ GUIInitOperation() : GraphicsContextOperation(std::string("GUI init"))
+ {
+ }
+ void run(osg::GraphicsContext* gc)
+ {
+ WindowSystemAdapter* wsa = WindowSystemAdapter::getWSA();
+ wsa->puInitialize();
+ puSetDefaultStyle ( PUSTYLE_SMALL_SHADED ); //PUSTYLE_DEFAULT
+ puSetDefaultColourScheme (0.8, 0.8, 0.9, 1);
+
+ FGFontCache *fc = globals->get_fontcache();
+ fc->initializeFonts();
+ puFont *GuiFont
+ = fc->get(globals->get_locale()->getStringValue("font",
+ "typewriter.txf"),
+ 15);
+ puSetDefaultFonts(*GuiFont, *GuiFont);
+ guiFnt = puGetDefaultLabelFont();
+
+ LayoutWidget::setDefaultFont(GuiFont, 15);