PDA

View Full Version : QGLWidget without an actual Window



zlacelle
2nd September 2014, 20:49
We are using QGLWidget, along with two shaders and some texture stuff, to do a bunch of video card texture manipulation and displaying it to a window. We also are taking these images and shipping them off over the network.

I want to be able to run the video card texture/shader code, hopefully still in a QGLWidget, but without an actual screen attached.

The issues I'm running into right now:

1) glewInit() fails with "Missing GL version", so we can't call glGenFramebuffer(), etc.
2) The context LOOKS valid (I do an isValid() check) but the OpenGL version is 1.0 (probably not correct...)
3) initializeGL() isn't called (since the window is hidden). I call it manually instead, but we have the glewInit() issue.

Is this possible to do? Do I need to create some fake window for the QGLWidget to be contained in?

Thank you for any help you have!

wysota
3rd September 2014, 07:15
With Qt5 this should be achievable, with Qt4 you certainly need a proper display available.

zlacelle
3rd September 2014, 17:30
Great, thank you for the response. Some specific questions:

* What feature in Qt5 enables me to do this?
* What do I have to do in Qt5 with no window attached to make sure that there is a valid OpenGL Context?
* What should I do to call initializeGL() correctly (after the context is created)? Normally, this happens automatically.

wysota
4th September 2014, 07:28
In Qt5 QpenGL is part of atari module which does not require X11 connection to work as all graphics operations are delegated to a platform specific QPA plugin.

As for the second question, use QOpenGL* classes I stead of QGL* classes.

Lastly, initializeGL should be called automatically after create() is called (explicitly or implicitly).