Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Moved] QtOpenGL/Qt3D without shaders do not work (intel i915) / partial fix
dmoreno last edited by
I've been some time creating a Qt3D game, but i had some problems to get it working, as it thought that I have fragment shaders and I dont. I hunted down the problem at Qt3d::QGLPainter::isFixedFunction() (~qglpainter.cpp:525). It is returning false and should be true, once forced it all work perfectly.
So I continued unwrapping, and the real culprit is Qt::QGLShaderProgram::hasOpenGLShaderPrograms, isnt it? Not sure as this checks if the system has the ability to compile shader programs. Maybe my system can. Actually it solves all the functions at qt_resolve_glsl_extensions() . So the problem is that isFixedFunction has a bug on how to check shader availability as it should check the extension that really do it, not the function, as the function may exist but not do the real thing.
So.. How to fix it? I dont really know, but here are my suggestions:
It should use QGLShaderProgram::hasOpenGLShaders(). I dont know how to make this work as its a object method (vs QGLShaderProgram::hasOpenGLShaderPrograms(), static class method).
Make QGLShaderProgram::hasOpenGLShaderPrograms() check for the right extension. My inhouse patch does this:
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index c7689b8..091d323 100644
@@ -3201,7 +3201,8 @@ bool QGLShaderProgram::hasOpenGLShaderPrograms(const QGLContext *context)
context = QGLContext::currentContext();
- return qt_resolve_glsl_extensions(const_cast<QGLContext *>(context));
- return qt_resolve_glsl_extensions(const_cast<QGLContext *>(context)) &&
QByteArray((const char *) glGetString(GL_EXTENSIONS)).contains("GL_ARB_fragment_shader");
- Optionally create an environment variable (QTGL_DONT_USE_SHADERS) or any mechanism for at least on tests force font use shaders.
Does anyone has suggestions on how to make properly this patch? And on how to add it to master qt or qt3d?
Disclaimer: Im not an OpenGL expert. Extensions that should be checked maybe are others.
sarasmit last edited by
This is definitely a bug - http://bugreports.qt.nokia.com/browse/QTBUG-18241
sarasmit last edited by
Bug http://bugreports.qt.nokia.com/browse/QTBUG-18241 closed as duplicate.