Results 1 to 9 of 9

Thread: QGLShaderProgram works on Debug mode, fails on running in Release.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QGLShaderProgram works on Debug mode, fails on running in Release.

    Would you click Projects and see whether "Shadow Build" is ticked. If it is, remove it. Now build again and run in release mode.

  2. #2
    Join Date
    Sep 2013
    Posts
    7
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGLShaderProgram works on Debug mode, fails on running in Release.

    That's even more strange... if I disable Shadow Build it doesn't run:
    The program has unexpectedly finished. ...Test3.exe exited with code -1073741515
    Edit: I found that this means that is missing some libs, it happens since disabling shadow build it is placed in another directory, after putting that dlls there I have the same "bool __thiscall QGLShaderPrivate::create(void): Could not create shader of type" error.

    So that didn't solve nothing but thank you for your time anyway.
    Last edited by escobar; 23rd September 2013 at 13:18.

  3. #3
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QGLShaderProgram works on Debug mode, fails on running in Release.

    Would you upload your shader programs in a different way. Add vertext.sh and fragment.sh to your src. Then try linking them this way as below:

    Qt Code:
    1. //#version 130
    2.  
    3. precision mediump float;
    4.  
    5. uniform mat4 mvpMatrix;
    6.  
    7. attribute vec4 vertex;
    8. attribute float color;
    9.  
    10. varying float varyingColor;
    11.  
    12. void main(void)
    13. {
    14. varyingColor = color;
    15. gl_Position = mvpMatrix * vertex;
    16. }
    To copy to clipboard, switch view to plain text mode 
    fragment shader has the same format, you know it. Then do this in the code:

    Qt Code:
    1. initCommon();
    2.  
    3. shaderProgram.addShaderFromSourceFile(QGLShader::Vertex, ":/vertexShader.vsh");
    4.  
    5. shaderProgram.addShaderFromSourceFile(QGLShader::Fragment, ":/fragmentShader.fsh");
    6.  
    7. if(!shaderProgram.link())
    8. {
    9. exit(1);
    10. }
    To copy to clipboard, switch view to plain text mode 

    initCommon() is:
    Qt Code:
    1. void GlWidget::initCommon()
    2. {
    3. //qglClearColor(QColor(Qt::black));
    4. glEnable(GL_DEPTH_TEST);
    5. glEnable(GL_CULL_FACE);
    6.  
    7. glEnable(GL_BLEND);
    8. glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    9. }
    To copy to clipboard, switch view to plain text mode 

    check this method and let us know about the result.

    PS: don't forget to upload your shaders to your resources.

  4. #4
    Join Date
    Sep 2013
    Posts
    7
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGLShaderProgram works on Debug mode, fails on running in Release.

    No luck, also I tried to load from "./a.vert" "./a.frag" it founds the files but they aren't created properly.



    It looks that the problem is during the compilation not on loading.

    compileSourceCode(code) doesn't work neither on Release but works on Debug.
    Last edited by escobar; 23rd September 2013 at 14:02.

  5. #5
    Join Date
    Sep 2013
    Posts
    7
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QGLShaderProgram works on Debug mode, fails on running in Release.

    I fixed it... just by updating to Qt 5.1.1

Similar Threads

  1. Replies: 1
    Last Post: 7th March 2012, 21:34
  2. Replies: 4
    Last Post: 27th May 2010, 15:18
  3. Replies: 1
    Last Post: 2nd November 2009, 12:02
  4. Replies: 9
    Last Post: 15th April 2009, 06:23
  5. Replies: 8
    Last Post: 10th October 2007, 18:20

Tags for this Thread

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.