From 3d388d2e93dba7ef14cd250b7b2705090cea3071 Mon Sep 17 00:00:00 2001 From: edouard Date: Fri, 10 Sep 2010 15:25:05 +0000 Subject: [PATCH] Modelview: another ugly fix to complte the first one. There is a lingering issue of initing the GL context on the first valid model that is loaded, this fix addresses it but it could be much more elegant, I'm sure. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1576 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/modelview/modelviewgadgetwidget.cpp | 6 +++++- ground/src/plugins/modelview/modelviewgadgetwidget.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ground/src/plugins/modelview/modelviewgadgetwidget.cpp b/ground/src/plugins/modelview/modelviewgadgetwidget.cpp index e2a4c5285..abad42a7a 100644 --- a/ground/src/plugins/modelview/modelviewgadgetwidget.cpp +++ b/ground/src/plugins/modelview/modelviewgadgetwidget.cpp @@ -40,6 +40,7 @@ ModelViewGadgetWidget::ModelViewGadgetWidget(QWidget *parent) , m_MotionTimer() { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + mvInitGLSuccess = false; CreateScene(); @@ -122,6 +123,8 @@ void ModelViewGadgetWidget::paintGL() // Display UI Info (orbit circle) m_MoverController.drawActiveMoverRep(); + mvInitGLSuccess = true; + } void ModelViewGadgetWidget::resizeGL(int width, int height) @@ -149,7 +152,8 @@ void ModelViewGadgetWidget::CreateScene() m_World= GLC_Factory::instance()->createWorldFromFile(aircraft); m_ModelBoundingBox= m_World.boundingBox(); loadError = false; - initializeGL(); + if (!mvInitGLSuccess) + initializeGL(); } else { loadError = true; } diff --git a/ground/src/plugins/modelview/modelviewgadgetwidget.h b/ground/src/plugins/modelview/modelviewgadgetwidget.h index 25639d206..6ec3b90a7 100644 --- a/ground/src/plugins/modelview/modelviewgadgetwidget.h +++ b/ground/src/plugins/modelview/modelviewgadgetwidget.h @@ -90,6 +90,7 @@ private: QString bgFilename; bool vboEnable; bool loadError; + bool mvInitGLSuccess; AttitudeActual* attActual; };