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. QOpenGLWidget doesn't draw OpenGL frame on macOS Mojave until a resize event occurs while built with CMake
Forum Updated to NodeBB v4.3 + New Features

QOpenGLWidget doesn't draw OpenGL frame on macOS Mojave until a resize event occurs while built with CMake

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 327 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.
  • A Offline
    A Offline
    anthel
    wrote on 1 Jan 2019, 23:09 last edited by anthel 1 Feb 2019, 19:04
    #1

    Greetings:

    I noticed that my QOpenGLWidget-based application (Qt ver. 5.12.0) doesn't display the OpenGL portion of the window until the window is resized on macOS Mojave (ver. 10.14.2) if I build with CMake as opposed to qmake. I observed this issue with Qt's "hellogl2" example as well. Does anyone have any thoughts? I have the "hellogl2" project file below along with what I thought its appropriate CMake counterpart would be (heavily influenced from Qt's CMake Manual). Thank you for your help with this.

    File hellogl2.pro

    HEADERS       = glwidget.h \
                    window.h \
                    mainwindow.h \
                    logo.h
    SOURCES       = glwidget.cpp \
                    main.cpp \
                    window.cpp \
                    mainwindow.cpp \
                    logo.cpp
    
    QT           += widgets
    
    # install
    target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl2
    INSTALLS += target
    

    Corresponding CMakeLists.txt:

    cmake_minimum_required(VERSION 3.1.0)
    
    # Define project name
    project(hellogl2)
    
    # set desired Qt version
    set(QT_VERSION_REQ "5.12.0")
    
    # Find includes in corresponding build directories
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    
    # Instruct CMake to run moc automatically when needed
    set(CMAKE_AUTOMOC ON)
    
    # Create code from a list of Qt Designer ui files
    set(CMAKE_AUTOUIC ON)
    
    # Find libraries
    # find_package(Qt5Core ${QT_VERSION_REQ} CONFIG REQUIRED)
    # find_package(Qt5Quick ${QT_VERSION_REQ} CONFIG REQUIRED)
    find_package(Qt5Widgets ${QT_VERSION_REQ} CONFIG REQUIRED)
    # find_package(Qt5Gui ${QT_VERSION_REQ} CONFIG REQUIRED)
    
    set(hellogl2_SRCS
        mainwindow.cpp
        window.cpp
        glwidget.cpp
        logo.cpp
        main.cpp
    )
    
    # Tell CMake to create the executable
    add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${hellogl2_SRCS})
    
    target_link_libraries(${PROJECT_NAME}
        Qt5::Widgets
    )
    

    Kind regards,
    Anthony

    1 Reply Last reply
    0

    1/1

    1 Jan 2019, 23:09

    • Login

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