Solved Switching from QOpenGLExtraFunctions to QOpenGLFunctions_4_4_Core broke rendering
-
Did 4.4 introduce any more shader programs that need to be defined for the pipeline? I seem to remember it adding 2 new shader types to the pipeline, but I was not sure they were required to be defined.
Edit: Versus 3.3
-
@fcarney As far as I know, you aren't required to use any of the new shader types. Just opt-in if they are useful for you. Using 3.3 core profile code under 4.4 should normally Just Work.
Try breaking out the debug logger class and see if it spits out anything useful: https://doc.qt.io/qt-5/qopengldebuglogger.html
?
-
@wrosecrans Yes, I'm already monitoring OpenGL errors using
glDebugMessageCallback
, but It shows no error, as well asglGetError
-
@fcarney I think that the point is that I already was successfully rendering in 4.4 Core, and now I just have changed the class which provides the OpenGL functions, I didn't change the OpenGL profile, and so I don't use any new features.
QOpenGLFunctions_4_4_Core
just has to give me more functions, but instead it broke already successfully used, may be some function calls don't happen for some reason, and so OpenGL state is broken. -
It says here that OpenGLExtraFunctions is for OpenGL ES:
https://doc.qt.io/qt-5/qopenglextrafunctions.html#detailsMaybe that is the difference. I have not programmed ES so I am unsure if the calls would be compatible.
-
@fcarney May be. I guess I have to make a separated project with minimal working code to determine the problem and where is the difference.
-
@fcarney Hi, I've solved the issue, I've appended explanation into the first post, that is a strange behavior for me, or I may miss something about how does QT work with framebuffers.
-
@mr.indieperson said in Switching from QOpenGLExtraFunctions to QOpenGLFunctions_4_4_Core broke rendering:
glBindFrameBuffer
Did you call glGenFramebuffers or where did you get the number for that framebuffer?
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBindFramebuffer.xhtmlApparently 0 breaks the binding to the GL_DRAW_FRAMEBUFFER
Edit: If its a "magic" number you tried it is likely to break later.
-
@fcarney No, that is not a magic number, I actually call
f->glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &defaultFboId)
inQOpenGLWidget::paintGL
, it just returns 4 always with current project code. Of course it may change. -
@fcarney And well, I've remembered about
QOpenGLWidget::defaultFramebufferObject
, it returns the same value asf->glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &defaultFboId)
, which I had to use when I was binding the default QT's framebuffer to do final rendering, but I just passed 0 and it was working, so I was thinking about it no more.