Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Issues with QPainter on Mac 10.10

    General and Desktop
    3
    6
    2014
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      Thoenu last edited by

      Hi all,

      if you are working with an OpenGL 4 Context on Mac, you will have the issue that the QT shaders are not compiling. When doing the following instruction:

      @QPainter painter(this);
      painter.setPen(Qt::white);
      QRect buttonRecL = QRect(948, 512, 70, 200);
      painter.drawText(buttonRecL, Qt::AlignCenter,"Placing\n\n\n\n\nReversed\n\n\n\n\nDanger");
      painter.drawRect(buttonRecL);@

      the following errors appear:

      @QGLShader::compile(Vertex): ERROR: 0:1: '' : #version required and missing.
      ERROR: 0:11: 'attribute' : syntax error: syntax error

      Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile
      QGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing.

      Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile QGLShader::link: "ERROR: One or more attached shaders not successfully compiled"
      Errors linking simple shader: ERROR: One or more attached shaders not successfully compiled

      QGLShader::compile(Vertex): ERROR: 0:1: '' : #version required and missing.
      ERROR: 0:5: 'attribute' : syntax error: syntax error

      Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile QGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing.
      ERROR: 0:11: 'varying' : syntax error: syntax error

      Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile
      QGLShader::link: "ERROR: One or more attached shaders not successfully compiled"
      Errors linking blit shader: ERROR: One or more attached shaders not successfully compiled

      QGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing.

      Warning: "" failed to compile!
      QGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing. @

      Just for a notification, there is for sure an OpenGL 4 Context running:

      @Widget OpenGl: 4.1
      Context valid: 1
      Really used OpenGl: 4.1@

      This works fine for Windows. I guess becaue there it is possible to mix OpenGL Versions inside a program. Under Mac this is not possible, because an OpenGL 4 header only accepts functions from 4.1 Core and Shaders with version 410 as far as I know.

      But, this also means, that the whole QT framework is compiling with QT4 (otherwise it wouldn't work already while compile time, wouldn't it?). For me, this means the only thing which is not adapted to the OpenGL 4 pipeline are the shaders. Since I know the problem from my own cross plattform engine, where I really need to have individual shaders for 410 and 430 and other GL version, I wonder if there are plans to solve that.

      My questions are now:

      1.) is this right, that there are no QtPainter Shaders available for Qt5 on Mac using a OpenGL 4 context? Or can I solve this issue anyhow?
      2.) since it should be possible to adapt the shaders I could do that by myself (maybe :)), but I accutally don't find the qt shaders and I also don't know if that is possible? Has someone ever done that?
      3.) is this already solved in future qt versions or did I miss here something?

      thanks for your efforts,
      Thoenu

      1 Reply Last reply Reply Quote 0
      • T
        tucher last edited by

        I have the EXACT same questions. The problem is still present even in Qt 5.4.
        Answer anybody, please.
        It is really annoying, because I can not find any information about.

        1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          You should probably this question to the "interest":http://lists.qt-project.org/mailman/listinfo/interest mailing list. You'll find there Qt's developers/maintainers (this forum is more user oriented)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 0
          • T
            Thoenu last edited by

            Thanks for the answer. I will try that.

            1 Reply Last reply Reply Quote 0
            • T
              Thoenu last edited by

              There is a workaround for that, by using a QPainter to a QImage and make a QOpenGLTexture from that and render it to a FBO.

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                Nice ! Thanks for sharing !

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post