[Qt-interest] QGLWidget Vs "-graphicssystem opengl"

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Thu Jul 16 06:41:34 CEST 2009


Oliver Demetz wrote on Thursday, July 16, 2009 2:29 AM:

> ...
> A) -graphicssystem opengl
> 
> versus
> 
> B) setting a QGLWidget as viewport of my QGraphicsScene

I don't know exactly what the switch -graphicsystem opengl does, but here are some thoughts:

- when using the switch-based solution, you give your users the possibility to choose whether or not to use OpenGL. Well, sounds obvious, but the advantage of this could be that if someone has a small-powered (or broken) OpenGL system, you give that person the choice. The software rendering could be faster, or the quality could be better (e.g. if their OpenGL driver does not implement good anti-aliasing etc.), or both.

- When using a QGLWidget as viewport, I guess you have the possibilities to explicitly set some OpenGL related options (in the method initializeGL() of your QGLWidget derived class), such as rendering hints which affect the speed/rendering quality. This gives you more flexibility.

To be honest, I have never used QGraphicsView/Scene myself so far, but I guess the http://doc.qtsoftware.com/4.5/qgraphicsview.html#renderHints-prop render hints are mapped onto the corresponding GL render hints, in case a QGLWidget is being used. But it could be that these render hints are not enough and you still would like to set more OpenGL specific settings -> this could be done in your QGLWidget derived class (maybe even making use of vendor-specific GL extensions etc.).

- I *guess* that when using the -graphicsystem opengl switch that the QGraphicsView will implicitly set a QGLWidget as viewport, so performance/quality-wise you would not see a difference between

  // without opengl switch
  QGraphicsView graphicsView;
  graphicsView.setViewport(new QGLWidget());

and

  // with opengl switch
  QGraphicsView graphicsView;

But again, this is only a guess. To be confirmed...


Greetings from Hyderabad :),
  Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list