Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. OpenGL shows black screen when using CMAKE system in QT5
Forum Updated to NodeBB v4.3 + New Features

OpenGL shows black screen when using CMAKE system in QT5

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    renato.viana
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      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?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

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

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • R Offline
          R Offline
          renato.viana
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • R Offline
            R Offline
            renato.viana
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

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

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved