From c825692a60e7ac9912350f530ea592952a3d9aa1 Mon Sep 17 00:00:00 2001 From: don bright Date: Sun, 5 Aug 2012 22:09:15 -0500 Subject: fix issue160 by adding updateGL() call after 'f5' (opencsg) diff --git a/src/mainwin.cc b/src/mainwin.cc index 3fdee6b..0d3c148 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1173,6 +1173,8 @@ void MainWindow::actionCompile() #endif } + glview->updateGL(); // issue 160 + if (viewActionAnimate->isChecked() && e_dump->isChecked()) { QImage img = this->glview->grabFrameBuffer(); QString filename; -- cgit v0.10.1 From a57637e1958eec0f359440b1543bfd14998274f3 Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 8 Aug 2012 20:42:39 -0500 Subject: check if running under wine, then run swapbuffers() if so diff --git a/src/glview.cc b/src/glview.cc index 624b266..b8c3015 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -374,6 +374,19 @@ 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 + 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); @@ -528,6 +541,11 @@ void GLView::paintGL() fmodf(360 - object_rot_x + 90, 360), fmodf(360 - object_rot_y, 360), fmodf(360 - object_rot_z, 360), viewer_distance); statusLabel->setText(msg); } + + if (running_under_wine()) { + // wine+qglwidget autobufferswap not reliable. issue 160. + swapBuffers(); + } } void GLView::keyPressEvent(QKeyEvent *event) diff --git a/src/mainwin.cc b/src/mainwin.cc index 0d3c148..3fdee6b 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -1173,8 +1173,6 @@ void MainWindow::actionCompile() #endif } - glview->updateGL(); // issue 160 - if (viewActionAnimate->isChecked() && e_dump->isChecked()) { QImage img = this->glview->grabFrameBuffer(); QString filename; -- cgit v0.10.1 From 029f0f2ba99d1e85dd05f5c863e41cedca37cad8 Mon Sep 17 00:00:00 2001 From: don bright Date: Wed, 8 Aug 2012 21:23:13 -0500 Subject: rearrange to check once at init, then use set variable 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 + 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 - 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) -- cgit v0.10.1