Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issues with QPainter on Mac 10.10

Issues with QPainter on Mac 10.10

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.2k Views
  • 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 Offline
    T Offline
    Thoenu
    wrote on last edited by
    #1

    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
    0
    • T Offline
      T Offline
      tucher
      wrote on last edited by
      #2

      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
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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
        0
        • T Offline
          T Offline
          Thoenu
          wrote on last edited by
          #4

          Thanks for the answer. I will try that.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Thoenu
            wrote on last edited by
            #5

            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
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved