I've found a nice tutorial on multithreaded OpenGL rendering on QGLWidget:
http://doc.trolltech.com/qq/qq06-gli...glapplications
But I have some questions about it:
1.
Qt Code:
  1. class GLThread : public QThread
To copy to clipboard, switch view to plain text mode 
Is it safe to modify GLThread's members:
Qt Code:
  1. bool doRendering;
  2. bool doResize;
  3. int w;
  4. ...
To copy to clipboard, switch view to plain text mode 
when GLThread thread is running and reads each variable every iteration?
I'm talking about

Qt Code:
  1. void GLWidget::resizeEvent(QResizeEvent *evt)
  2. { /*glt is GLThread's object*/
  3. glt.resizeViewport(evt->size());
  4. }
To copy to clipboard, switch view to plain text mode 


2. Is it safe to modify more complex GLThread's members when GLThread thread is running? E.g.
Qt Code:
  1. class MyComplexGLThreadMemberClass {
  2. int a;
  3. double b;
  4. vector<int> c;
  5. };
To copy to clipboard, switch view to plain text mode 

3.
Qt Code:
  1. class GLWidget : public QGLWidget
To copy to clipboard, switch view to plain text mode 

Is it safe to call GLWidget's methods from a running GLThread thread?
Qt Code:
  1. void GLThread::run()
  2. {
  3. glw->makeCurrent();
  4. while (doRendering) {
  5. // Rendering code goes here
  6. glw->swapBuffers();
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 
Here is my source code for Qt4.7 and exe file built with Qt4.7, you'll need Qt dlls to run it.
TestGl.zip
TestGl_exe.zip