Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Sharing QOpenGLContext on devices where QSG runs on main thread

Sharing QOpenGLContext on devices where QSG runs on main thread

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
opengl under qmandroidthreadingqopenglcontextshared
1 Posts 1 Posters 738 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.
  • KostasK Offline
    KostasK Offline
    Kostas
    wrote on last edited by
    #1

    I have an application that runs on iOS and android and is at it's latest development phase. It uses the OpenGL under QML paradigm and has a worker thread that shares it's OpenGLContext with the QSG context in order to upload 3d stuff to the GPU in the background and do the actual drawing on the QSG thread.

    While testing the app for android I noticed that on some devices the QSG thread is actually the same as the main Qt thread (the Samsung Galaxy Tab3 is an example) instead of the typical QSG running on a dedicated thread.

    My problem is that on those devices I can't make the QSG context share with the context on my worker thread resulting in my program crashing.

    I create an offscreen surface for my worker thread :

    // this runs on the main thread as per the documentation
    m_surface = new QOffscreenSurface();
    m_surface->create();
    

    and then I create the context

    // this runs on the worker thread
    m_context = new QOpenGLContext();
    m_context->setShareContext(m_qsgContext);
    m_context->create();
    m_context->makeCurrent(m_surface)
    QOpenGLContext::areSharing(m_context, m_qsgContext) // returns false
    

    Is there something something special I should be aware of for these kind of devices? My code works on all the iPhones/iPads and on all the android devices I have tested (except the one mentioned above).

    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