-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.3
-
None
-
GNU/Linux Ubuntu 10.04.
Intel 945GM/GMS/GME, 943/940GML.
-
bf5c25c4e7571475255e1d9de307913bee228d10
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:
1. It should use QGLShaderProgram::hasOpenGLShaders(). I dont know how to make this work as its a object method (vs QGLShaderProgram::hasOpenGLShaderPrograms(), static class method).
2. 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 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @ -3201,7 +3201,8 @ bool QGLShaderProgram::hasOpenGLShaderPrograms(const QGLContext *context) context = QGLContext::currentContext(); if (!context) return false; - 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"); #else Q_UNUSED(context); return true;
3. 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?
Thanks.
Disclaimer: Im not an OpenGL expert. Extensions that should be checked maybe are others.
- resulted in
-
QTBUG-13179 QGLShader::hasOpenGLShaders returns false on OpenGL1.x even when GL_ARB_shader_language_xxx supported
-
- Closed
-