Issues with QPainter on Mac 10.10



  • 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



  • 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.


  • Lifetime Qt Champion

    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)



  • Thanks for the answer. I will try that.



  • 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.


  • Lifetime Qt Champion

    Nice ! Thanks for sharing !


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.