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 context and testing with catch2

OpenGL context and testing with catch2

Scheduled Pinned Locked Moved Unsolved General and Desktop
testopenglcontext
1 Posts 1 Posters 623 Views
  • 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.
  • B Offline
    B Offline
    BePie
    wrote on last edited by
    #1

    I'am trying to test my class that uses QOpenGLTexture but it cannot use QOpenGLTexture becouse there is no OpenGL context. I tried this:

    
    // gui app
        char *dummyArgv[] = {"dummy program name", NULL};
        int dummyArgc = sizeof(dummyArgv) / sizeof(char*) - 1;
        QGuiApplication app(dummyArgc, dummyArgv);
    
    // try 1 
        const auto screens = QGuiApplication::screens();
        REQUIRE(screens.size() > 0);
        QOpenGLContext context;
        context.setScreen(screens[0]);
        REQUIRE(context.create());
        REQUIRE(context.isValid());
    
    // try 2
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/window.qml")));
    
    // try 3
        QQuickView *view = new QQuickView;
        view->setSource(QUrl(QStringLiteral("qrc:/rect.qml")));
        view->show();
    
    

    but I get

    Requires a valid current OpenGL context.
    Texture has not been created
    

    all the time.
    Is there a valid way to create a OpenGL context for QOpenGL-classes without running event loop?

    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