summaryrefslogtreecommitdiff
path: root/src/glview.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2012-08-09 02:23:13 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2012-08-09 02:23:13 (GMT)
commit029f0f2ba99d1e85dd05f5c863e41cedca37cad8 (patch)
tree8576f0aa981b473bcba85528e9625cae02fdd06d /src/glview.cc
parenta57637e1958eec0f359440b1543bfd14998274f3 (diff)
rearrange to check once at init, then use set variable
Diffstat (limited to 'src/glview.cc')
-rw-r--r--src/glview.cc29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/glview.cc b/src/glview.cc
index b8c3015..859bf82 100644
--- a/src/glview.cc
+++ b/src/glview.cc
@@ -69,6 +69,8 @@ GLView::GLView(const QGLFormat & format, QWidget *parent) : QGLWidget(format, pa
init();
}
+static bool running_under_wine = false;
+
void GLView::init()
{
this->viewer_distance = 500;
@@ -100,6 +102,15 @@ void GLView::init()
static int sId = 0;
this->opencsg_id = sId++;
#endif
+
+// see paintGL() + issue160 + wine FAQ
+#ifdef _WIN32
+#include <windows.h>
+ HMODULE hntdll = GetModuleHandle(L"ntdll.dll");
+ if (hntdll)
+ if ( (void *)GetProcAddress(hntdll, "wine_get_version") )
+ running_under_wine = true;
+#endif
}
void GLView::setRenderer(Renderer *r)
@@ -374,19 +385,6 @@ void GLView::setupOrtho(double distance, bool offset)
gluLookAt(0.0, -viewer_distance, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0);
}
-static bool running_under_wine()
-{
- bool result=false;
-#ifdef _WIN32
-#include <windows.h>
- HMODULE hntdll = GetModuleHandle(L"ntdll.dll"); // see Wine FAQ
- if (hntdll)
- if ( (void *)GetProcAddress(hntdll, "wine_get_version") )
- result=true;
-#endif
- return result;
-}
-
void GLView::paintGL()
{
glEnable(GL_LIGHTING);
@@ -542,10 +540,7 @@ void GLView::paintGL()
statusLabel->setText(msg);
}
- if (running_under_wine()) {
- // wine+qglwidget autobufferswap not reliable. issue 160.
- swapBuffers();
- }
+ if (running_under_wine) swapBuffers();
}
void GLView::keyPressEvent(QKeyEvent *event)
contact: Jan Huwald // Impressum