[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] Errors while rendering to multiple QGLWidgets in a
From: Michael Broxton <broxton () stanford ! edu>
Date: 2011-10-28 2:04:40
Message-ID: C926C748-698D-44CC-81FB-27A04DFBA482 () stanford ! edu
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi there,
I'm attempting to write a PyQt application that renders to different QGLWidgets from \
different threads (there is one QGLWidget accessed in each thread, and each thread \
only renders to its one widget -- therefore the opengl contexts should be strictly \
kept to their separate threads). However my application crashes soon after two or \
more QGLWidgets are open and rendering. It looks very much like the two threads are \
rendering into the same OpenGL context, with a typical error message looking like \
this:
GLError(
err = 1282,
description = 'invalid operation',
baseOperation = glEnd,
cArguments = ()
)
as if glEnd() had been called twice in a row in the same context without a glBegin() \
in between. This shouldn't happen if the threads are rendering into different \
contexts, though, and I have very carefully checked using Apple's OpenGL Profiling \
tool and each thread definitely has its own gl context. After a lot of debugging, \
I'm stumped as to why this is happening! I have created a very simple test program \
that illustrates the problem here:
https://gist.github.com/1318290
For more background: I'm running OSX 10.7.2 on a macbook pro with Qt version 4.7.4 \
and PyQt 4.8.6. I have also tested this program on a similarly configured Windows 7 \
machine, and experienced the same problem. My test code is based on this old(ish) \
article about multi-threaded GL rendering in Qt, available here:
http://doc.qt.nokia.com/qq/qq06-glimpsing.html#writingmultithreadedglapplications
A straight C++ implementation (snagged from the github repo of Anders Wallin) of this \
method can be downloaded here:
http://graphics.stanford.edu/~broxton/qt_opengl_threads.tgz
My python test harness is essentially identical to this C++ code, but the C++ code \
compiles and runs fine on my computer without any issue. Everything on the 'net \
leads me to believe that I'm doing this multi-threaded rendering correctly, so I \
think that this is a Python/OpenGL or PyQt related issue, and not a Qt issue. Thus, \
it feels like it is time to escalate the issue and seek out some help!
Any assistance in figuring this out would be greatly appreciated. Thanks!
-Michael
[Attachment #5 (unknown)]
<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; ">Hi there,<div><br></div><div>I'm attempting \
to write a PyQt application that renders to different QGLWidgets from different \
threads (there is one QGLWidget accessed in each thread, and each thread only renders \
to its one widget -- therefore the opengl contexts should be strictly kept to their \
separate threads). However my application crashes soon after two or more \
QGLWidgets are open and rendering. It looks very much like the two threads are \
rendering into the same OpenGL context, with a typical error message looking like \
this:</div><div><br></div><div><div>GLError(</div><div> \
err = 1282,</div><div> description = 'invalid \
operation',</div><div> baseOperation = \
glEnd,</div><div> cArguments = \
()</div><div>)</div></div><div><br></div><div>as if glEnd() had been called twice in \
a row in the same context without a glBegin() in between. This shouldn't happen \
if the threads are rendering into different contexts, though, and I have very \
carefully checked using Apple's OpenGL Profiling tool and each thread definitely has \
its own gl context. After a lot of debugging, I'm stumped as to why this is \
happening! I have created a very simple test program that illustrates the \
problem here:</div><div><br></div><div><span class="Apple-tab-span" \
style="white-space: pre; "> </span><a \
href="https://gist.github.com/1318290">https://gist.github.com/1318290</a></div><div><br></div><div>For \
more background: I'm running OSX 10.7.2 on a macbook pro with Qt version 4.7.4 \
and PyQt 4.8.6. I have also tested this program on a similarly configured \
Windows 7 machine, and experienced the same problem.</div><div>My test code is based \
on this old(ish) article about multi-threaded GL rendering in Qt, available \
here:</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre; \
"> </span><a href="http://doc.qt.nokia.com/qq/qq06-glimpsing.html#writingmultithreaded \
glapplications">http://doc.qt.nokia.com/qq/qq06-glimpsing.html#writingmultithreadedglapplications</a></div><div><br></div><div>A \
straight C++ implementation (snagged from the github repo of Anders Wallin) of this \
method can be downloaded here:</div><div><br></div><div><span class="Apple-tab-span" \
style="white-space: pre; "> </span>http://<span class="Apple-tab-span" \
style="white-space: pre; "><a \
href="http://graphics.stanford.edu/~broxton/qt_opengl_threads.tgz">graphics.stanford.edu/~broxton/qt_opengl_threads.tgz</a></span></div><div><br></div><div>My \
python test harness is essentially identical to this C++ code, but the C++ code \
compiles and runs fine on my computer without any issue. Everything on the 'net \
leads me to believe that I'm doing this multi-threaded rendering correctly, so I \
think that this is a Python/OpenGL or PyQt related issue, and not a Qt issue. \
Thus, it feels like it is time to escalate the issue and seek out some help! \
</div><div><span class="Apple-tab-span" style="white-space: pre; \
"> </span></div><div>Any assistance in figuring this out would be greatly \
appreciated. Thanks!</div><div><br></div><div><span class="Apple-tab-span" \
style="white-space: pre; "> </span>-Michael</div></body></html>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic