[Interest] OpenGL and resolving gl functions

Roger Leigh rleigh at codelibre.net
Mon Dec 2 17:56:20 CET 2013


I'm fairly new to using OpenGL with Qt, so apologies if these
questions are too basic.

I've created some fairly simple programs with QGLWidget and
lately converted these to use a reparented QWindow +
QOpenGLFunctions using QWidget::createWindowContainer which
works OK.  These were all based upon what the Qt OpenGL
examples and documention were recommending.

1) I read that there were plans to create a QOpenGLWidget
   class to replace QGLWidget in 5.2.0, and I found
   QTBUG-31771, but this has very little information.  Is this
   still planned?  It would certainly make things a bit simpler!

2) This is a bit more general, and relates to how to best use
   the GL API with Qt.

   When using a class inheriting QOpenGLFunctions I get the GL
   functions made available, and if I copy the Qt OpenGL
   examples and do all my drawing in a paintGL/render (or
   equivalent) method then this is fine--the functions are all
   exposed in the class method.

   However, I'm wondering what to do when things become more
   complex, and I have (for example) many hundreds of objects
   of which is responsible for drawing itself, or if I have a
   number of helper classes which might be using plain OpenGL
   and be unaware of Qt.  How best to structure things so that
   I can have more complex drawing and computation kept
   separate from the Qt OpenGL view(s)?  What sorts of strategies
   should be employed to get the OpenGL functions made available
   to these classes?  Deriving each from QOpenGLFunctions seems a
   little excessive (and might not even be possible).  But using
   some additional facility like GLEW also seems impractical given
   its incompatibility with QOpenGLFunctions and also seems

I'd be very interested in any insights anyone can share.

Many thanks,

  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800

More information about the Interest mailing list