Using QOpenGLWidget without using QOpenGLFunctions
-
Hi all,
I manage a large desktop application written in OpenGL and Qt, and I'm currently transitioning from Qt4.8 to Qt5.5. I'm interested in using the QOpenGLWidget as a surface without needing to convert all of my existing graphics code to use a QOpenGLFunctions object (via subclassing or anything else); that is, I'd like to be able to continue using the global GL bindings.
My question is this: does anyone have a working example of this or documentation that it cannot be done?
My setup and issue:
Under Qt4.8, I used the QGLWidget and GLEW, all GL calls were made within the widget's paintGL stack but by numerous subcomponents and utilities, and everything worked fine. After switching to Qt5.5, I wish to use to QOpenGLWidget both to avoid Qt's verbose warnings and also simply for good practice. I have no interest in using Qt's graphics utilities--QShaderProgram, etc--as we have our own; Qt is my windowing framework, not my graphics framework. Unfortunately, any gl*Framebuffer or gen*Buffer calls (and possibly more, but I haven't tested exhaustively) now segfault immediately, even though nothing has changed except for QGLWidget -> QOpenGLWidget.
Things I've already tried:
- I've made sure to eradicate the "qopenglfunctions doesn't work with glew" warning. No compilation unit includes both of them.
- Within QOpenGLWidget, I've verified that it's context is current when my graphics calls are made
- I've made sure that my code writes to the FBO held by the widget (not FBO 0)--not that execution gets that far
- Using GDB, I've verified that my GL function pointers are the same in either case (Qt isn't mangling the bindings somehow)
- I've checked that "context()->functions()->glGenFramebuffers()" (e.g.) does work, while "glGenFramebuffers()" does not
-
Hi, welcome to devnet.
Few things to get out of the way.
- Have you initialized GLEW, i.e. called glewInit() in
QOpenGLWidget::initializeGL
or anywhere else with current context? - Was a call to
glewInit
successful (returned GLEW_OK)? - Have you set a context version and have checked that the context you get is a version you requested? Are the missing functions present in the version you are getting?
- Have you initialized GLEW, i.e. called glewInit() in