Opengl contexts agl, wgl, glx
Is it possible to create own opengl contexts which hooks in a normal QT widget instead of using a QGLWidget. I want to make the display drivers independent from the toolkit.
Thanks in advance
I have tried it. My opengl code works within a QGLWidget but not by generating an own agl context (Mac). I don't get a error message. I think the problem is the binding of a standard widget with the agl context. I am using widget->winID(). Is there another way doing this? The winID() works for a directx context.
I have never tried on Mac, but it's possible to create QWidget with own OpenGL context.
You must set QWidget attributes:
Override QWidget::paintEvent and do nothing in that event.
When creating context you will need native window handle (this is code for EGL on X11, so I don't how to create GL context on Mac):
@eglDisplay = eglGetDisplay((EGLNativeDisplayType)x11Info().display());
eglInitialize(eglDisplay, &majorVersion, &minorVersion);
// all other create context stuff...@
Hope this helps.
See this post for doing it on the mac (this is specific to setting Lion OpenGL core profile 3.2) but it should work for other context just change the code, the post from mcdi half way down is what I used
Thank you, but I have decided for a QGLWidget.