OpenGL shows black screen when using CMAKE system in QT5



  • Hi,

    I got the texture exemple and port the build system to CMAKE. But when I run it shows a black screen. I’m using QT5.

    Does everyone know something about it??

    Here is my CMAKE code:

    QT5_ADD_RESOURCES(RESOURCES_GENERATED_FILES ${RESOURCE_FILES})

    ADD_EXECUTABLE(QtTexture ${SRC_FILES} ${HEADER_FILES} ${RESOURCES_GENERATED_FILES})

    TARGET_LINK_LIBRARIES(QtTexture OPENGL32 GLU32 GLEW32)

    QT5_USE_MODULES(QtTexture Core Widgets OpenGL)

    Thanks,
    Renato


  • Moderators

    welcome to devnet

    there is no need in double posting in this forum. Even so your "other post":http://qt-project.org/forums/viewthread/25568/ has more text

    Probably you need to line out a few things.
    Does cmake end successfully?
    Do you get the black when starting your application?
    How do you start your application?


  • Lifetime Qt Champion

    Hi,

    Additionally to what koahnig asked, your opengl code would also be useful.



  • Hi.

    The CMAKE end sucessfully. The code compiles but the GLWidgets shows a black screen. I don't know what is the problem because the draw function is called normally.

    The opengl code is the QT texture example.. Nothing more.

    Thanks.
    Renato



  • Hi Koahning and SGaist.

    Thanks for the help and the information. I've found the problem. It seems that I can not link the QT project with the standard OpenGL lib. I need to link with the libOpenGLES.lib that is inside the QT lib path.

    Now the application is running correctly. But it's a strange behaviour because. It seems that the QT does not work well with the standard OpenGL32.lib.

    The error was in this line of the CMAKE commands "TARGET_LINK_LIBRARIES(QtTexture OPENGL32 GLU32 GLEW32)"

    Thanks,
    Renato


  • Lifetime Qt Champion

    IIRC, Qt 5 comes built for OpenGL ES/Angle on windows. If you want desktop OpenGL you have to rebuild Qt yourself


Log in to reply
 

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