Results 1 to 3 of 3

Thread: OpenGL + QSurfaceFormat (set opengl 3+ version) + QPainter = crash

  1. #1
    Join Date
    May 2006
    Posts
    57
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default OpenGL + QSurfaceFormat (set opengl 3+ version) + QPainter = crash

    Hi!

    I'm learning to use OpenGL 3.2 in Qt5, I understand that you want to use version 3.2 must use QSurfaceFormat follows:

    Qt Code:
    1. QSurfaceFormat format;
    2. format.setVersion(3, 2);
    3. format.setProfile(QSurfaceFormat::CompatibilityProfile);
    To copy to clipboard, switch view to plain text mode 

    But if I set a version 3.0 and up, when I use QPainter to draw information in the screen, crash my program, with this error message:

    QOpenGLShader::compile(Vertex): Vertex shader failed to compile with the following errors:
    ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
    ERROR: error(#273) 1 compilation errors. No code generated
    Obviously this is because GLSL 1.10 is only supports by OpenGL 2.0, and I need use GLSL 1.50 for OpenGL 3.2, and for OpenGL 4 GLSL 4, but I don't know how to specify this, because is an internal code for QPainter.

    Anyone can help me?

    I use:

    Qt 5.2.1 and Qt 5.3.0
    Windows 8.1 64 bits and Linux 64 bits(Ubuntu 14.04, with online installation, not from repositories)
    AMD Radeon HD 7700 Series
    Version of Catalyst 14.4

  2. #2
    Join Date
    Oct 2014
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: OpenGL + QSurfaceFormat (set opengl 3+ version) + QPainter = crash

    Hi,
    I got more or less the same problem:

    In my case the crash occurs when using a QGLWidget:
    - set version 3.2 in the format
    - use the CoreProfile
    - open a QPainter with the QGLWidget as a paintDevice

    At the moment you create the QPainter, it gives the same error as above...
    By setting the CoreProfile I am able to use OpenGL 3.2 (printing out the version of QGLWidget::format() in the paint function, I get 3.2)
    But I think the QPainter is still using some of the older API's which are not available any more in the CoreProfile.
    The shaders which are mentioned in the errors are not mine (I don't even use any shaders of my own)

    Qt Code:
    1. QGLShader::compile(Vertex): ERROR: 0:1: '' : #version required and missing.
    2. ERROR: 0:11: 'attribute' : syntax error syntax error
    3.  
    4. Vertex shader for simpleShaderProg (MainVertexShader & PositionOnlyVertexShader) failed to compile
    5. QGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing.
    6.  
    7. Fragment shader for simpleShaderProg (MainFragmentShader & ShockingPinkSrcFragmentShader) failed to compile
    8. QGLShader::link: "ERROR: One or more attached shaders not successfully compiled
    9. "
    10. Errors linking simple shader: ERROR: One or more attached shaders not successfully compiled
    11.  
    12. QGLShader::compile(Vertex): ERROR: 0:1: '' : #version required and missing.
    13. ERROR: 0:5: 'attribute' : syntax error syntax error
    14.  
    15. Vertex shader for blitShaderProg (MainWithTexCoordsVertexShader & UntransformedPositionVertexShader) failed to compile
    16. QGLShader::compile(Fragment): ERROR: 0:1: '' : #version required and missing.
    17. ERROR: 0:11: 'varying' : syntax error syntax error
    18.  
    19. Fragment shader for blitShaderProg (MainFragmentShader & ImageSrcFragmentShader) failed to compile
    20. QGLShader::link: "ERROR: One or more attached shaders not successfully compiled
    21. "
    22. Errors linking blit shader: ERROR: One or more attached shaders not successfully compiled
    To copy to clipboard, switch view to plain text mode 

    Hopefully someone can help us with this extra information,
    kr,
    dabu

    I use:
    Qt 5.3
    OS: Mac OSX 10.8.5
    GPU: AMD Radeon HD 6750M 512 MB

  3. #3
    Join Date
    Mar 2016
    Posts
    19
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: OpenGL + QSurfaceFormat (set opengl 3+ version) + QPainter = crash

    hi @dabu and @avis_phoenix
    @avis_phoenix according to say of @dabu you can fix your this error but if you test, I interested to know result.
    and @dabu, please explain your problem more!
    Are you set your version of shader?

Similar Threads

  1. < problem> supported OpenGL version by Qt
    By public in forum Qt Programming
    Replies: 3
    Last Post: 24th January 2011, 19:21
  2. graphicsview & opengl version 1.4 problem
    By dkoryagin in forum Qt Programming
    Replies: 3
    Last Post: 15th September 2010, 08:20
  3. OpenGL and QPainter
    By wererabit in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2010, 07:25
  4. OpenGL version
    By uj in forum Qt Programming
    Replies: 5
    Last Post: 28th January 2010, 16:01
  5. Crash when minimizing OpenGL widget
    By MistaPain in forum Qt Programming
    Replies: 5
    Last Post: 7th October 2006, 17:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.