Qt + OpenGL: pictures in OpenGL widgets swap.



  • Hello. I have an application that renders multiple OpenGL 'screens'. in multiple windows. Image data for screens is in YUV colorspace. Shaders translate it to RGB. For each screen I use 3 textures: for Y, U and V respectively, and combine them in shader.
    When have 2 windows and add 1 screen to each one, pictures in screens start swapping randomly. It does not happen when I use 1 texture (for example, just drawing RGB images).
    Unfortunately, I can't reproduce this issue in a sketch application. Please give me some hint where I can find info about this issue. Can Qt be involved in this issue, or is it OpenGL or me?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If you can't reproduce that in a "dummy" application, then it's likely that you are doing something wrong. However without seeing any code it's pretty difficult to tell you what might be going wrong. Did you check that your context are always current ? Are you sharing one context across several widgets ?



  • Hello, SGaist. Sorry for my late answer.
    Contexts of corresponding widgets are always current at the time of drawing (in paintGL()). And they are always different for different widgets. I did not share them explicitly, can there be any implicit sharing?
    I will try to reproduce the issue again. If I succeed, I will post the code.
    If you have more ideas what can I check, post them, please. Thank you.



  • @SGaist, take a look please.
    I reproduced the issue successfully.
    This is the example application.
    To reproduce the issue start the application, open .yuv files in each window, then move mouse from and to button several times in any window. OpenGL widget will show a frame from other file.


  • Lifetime Qt Champion

    Sorry, my current system doesn't provide that OpenGL profile currently.

    In any case, what kind of YUV image is it ? 4:4:4 ? 4:2:2 ?



  • @SGaist, files in project are in YV12 format.
    Here is the video of what is happening.
    First, I open yuvnumbers1 file (white background) in first window. Next, I open yuvnumbers2 file (green background) in second window. Pictures swap immediately. Then I move mouse cursor from and to open button (cursor is not seen, but button becomes highlighted), and pictures swap again for a moment. Same for other window.
    Sometimes video in window that opened file second just freezes. UpdateRequest events are received, but Paint events occur only when I move the cursor over button, or move the window.


Log in to reply
 

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