Results 1 to 1 of 1

Thread: Raw OpenGL not working in QOpenGLWidget with QT 5.11

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2020
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Raw OpenGL not working in QOpenGLWidget with QT 5.11

    Hello All:
    As before we're working on QT 5.6 with QOpenGLWigdget, and call raw OpenGL API inside it
    Qt Code:
    1. SummWidget::initializeGL()
    2. {
    3. initializeOpenGLFunctions();
    4.  
    5. // do call raw openGL API
    6. }
    7. void SummWidget::paintGL()
    8. {
    9. // do call raw opengl API
    10. }
    To copy to clipboard, switch view to plain text mode 
    It works well, but when we upgrade to QT 5.11, there is no render image show on QT(QT works well), and GPU is working.
    and we tried that
    Qt Code:
    1. GLuint LoadShader ( GLenum type, const char *shaderSrc )
    2. {
    3. GLuint shader;
    4. GLint compiled;
    5.  
    6. // Create the shader object
    7. shader = glCreateShader ( type );
    8.  
    9. if ( shader == 0 )
    10. return 0;
    11.  
    12. // Load the shader source
    13. glShaderSource ( shader, 1, &shaderSrc, NULL );
    14.  
    15. // Compile the shader
    16. glCompileShader ( shader );
    17.  
    18. // Check the compile status
    19. glGetShaderiv ( shader, GL_COMPILE_STATUS, &compiled );
    20.  
    21. if ( !compiled )
    22. {
    23. GLint infoLen = 0;
    24.  
    25. glGetShaderiv ( shader, GL_INFO_LOG_LENGTH, &infoLen );
    26.  
    27. if ( infoLen > 1 )
    28. {
    29. char* infoLog = (char* )malloc (sizeof(char) * infoLen );
    30.  
    31. glGetShaderInfoLog ( shader, infoLen, NULL, infoLog );
    32. printf ( "Error compiling shader:\n%s\n", infoLog );
    33.  
    34. free ( infoLog );
    35. }
    36.  
    37. glDeleteShader ( shader );
    38. return 0;
    39. }
    40.  
    41. return shader;
    42.  
    43. }
    44. void TestDraw()
    45. {
    46.  
    47. GLfloat vVertices[] = { 0.0f, 0.5f, 0.0f,
    48. -0.5f, -0.5f, 0.0f,
    49. 0.5f, -0.5f, 0.0f };
    50.  
    51. // Set the viewport
    52. glViewport ( 0, 0, 670, 720 );
    53.  
    54. // Clear the color buffer
    55. glClear ( GL_COLOR_BUFFER_BIT );
    56.  
    57. // Use the program object
    58. glUseProgram (programObject );
    59.  
    60. // Load the vertex data
    61. glVertexAttribPointer ( 0, 3, GL_FLOAT, GL_FALSE, 0, vVertices );
    62. glEnableVertexAttribArray ( 0 );
    63.  
    64. glDrawArrays ( GL_TRIANGLES, 0, 3 );
    65.  
    66. }
    To copy to clipboard, switch view to plain text mode 

    call the TestDraw() in paintGL(), then we can see a red triangle if remove the legacy raw opengl code.
    if put them together,nothing show up event put the TestDraw() at the end.
    Any suggestion? Thanks
    Last edited by andy.yin; 31st July 2020 at 17:12.

Similar Threads

  1. Replies: 1
    Last Post: 1st August 2016, 18:28
  2. openGL bindtexture from within thread not working
    By thinkabit in forum Qt Programming
    Replies: 0
    Last Post: 23rd April 2011, 13:13
  3. Replies: 1
    Last Post: 4th February 2011, 04:34
  4. Replies: 0
    Last Post: 6th December 2009, 01:41
  5. aux functions not working on opengl
    By john_god in forum Qt Programming
    Replies: 7
    Last Post: 11th April 2009, 13:23

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.