日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Qt WA_TranslucentBackground 导致视频渲染不了的问题

發布時間:2024/1/8 编程问答 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Qt WA_TranslucentBackground 导致视频渲染不了的问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

使用QT5.7 + VS2015做的試驗,視頻渲染使用D3D9。發現的規律是:

頂層窗口(指父窗口為NULL的窗口)如果設置了

this->setWindowFlags( Qt::FramelessWindowHint);this->setAttribute(Qt::WA_TranslucentBackground,true);

那么不管是用該頂層窗口本身的窗口句柄,還是使用子窗口的句柄作為D3D的渲染窗口,都渲染不出來。如果頂層窗口沒有同時設置以上的屬性/標志,子窗口不管設置還是沒有設置以上兩個屬性/標志,視頻都可以渲染出來。

調試了下,D3D的初始化、渲染接口都能成功執行,找了不少論壇,后來在一個頁面上看到有類似的說明:

OpenGL_and_translucent_background_do_not_work_together_due_to_a_limitation

里面提到:

Due to a limitation in window managers, it is not possible to combine OpenGL with a translucent background window (set with WA_TranslucentBackground). The reason for this is because OpenGL is rendered directly onto the screen and the compositor used to enable the translucent background cannot ensure that the OpenGL is rendered correctly.

There is nothing that can be done in Qt to fix this as it needs to be done on the side of the window manager.

To work around this issue you can either just use Qt to render everything and not OpenGL, or you can render the OpenGL into a pixmap and draw that onto your widget instead.

大意是OpenGL是直接渲染在屏幕的,而透明背景的compositor不能保證OpenGL可以正確地渲染,我想D3D也是一樣的原理,直接訪問顯卡,所以D3D在這種情況下不能渲染視頻,估計也是這個原因,它里面還提到了對于這個問題Qt做不了什么,因為這需要窗口管理器那邊來解決這個問題。

我又嘗試了使用Dib來貼圖,仍然失敗??磥砟壳斑€未有解決辦法。

總結

以上是生活随笔為你收集整理的Qt WA_TranslucentBackground 导致视频渲染不了的问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。