Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-12478

QtOpenGL/Qt3D without shaders do not work (intel i915) / partial fix

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 4.7.1
    • 4.6.3
    • GUI: OpenGL, Qt3D
    • 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.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            rweather Rhys Weatherley (closed Nokia identity) (Inactive)
            dmoreno David Moreno
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes