久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何同時使用 Qt 和 SDL?

How do I use Qt and SDL together?(如何同時使用 Qt 和 SDL?)
本文介紹了如何同時使用 Qt 和 SDL?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在 Windows 中構建物理模擬引擎和編輯器.我想使用 Qt 構建編輯器部分,并且我想使用 SDL 和 OpenGL 運行引擎.

I am building a physics simulation engine and editor in Windows. I want to build the editor part using Qt and I want to run the engine using SDL with OpenGL.

我的第一個想法是僅使用 Qt 構建編輯器,并與引擎(資源管理器、渲染器、數學)共享盡可能多的代碼.但是,我也希望能夠在編輯器中運行模擬.這意味著我還必須分享使用 SDL 線程的模擬代碼.

My first idea was to build the editor using only Qt and share as much code with the engine (the resource manager, the renderer, the maths). But, I would also like to be able to run the simulation inside the editor. This means I also have to share the simulation code which uses SDL threads.

所以,我的問題是:有沒有辦法使用 SDL 將 OpenGL 渲染到 Qt 窗口?

So, my question is this: Is there a way to have an the render OpenGL to a Qt window by using SDL?

我在網上讀到,可能可以為 SDL 提供一個窗口句柄來進行渲染.有人有這方面的經驗嗎?

I have read on the web that it might be possible to supply SDL with a window handle in which to render. Anybody has experience dong that?

此外,模擬器的線程部分可能會造成問題,因為它使用 SDL 線程.

Also, the threaded part of the simulator might pose a problem since it uses SDL threads.

推薦答案

雖然您可能會像第一個答案一樣讓它工作,但您可能會因線程處理而遇到問題.在線程方面沒有簡單的解決方案,在這里您將有 SDL Qt 和 OpenGL 主循環交互.不好玩.

While you might get it to work like first answer suggest you will likely run into problems due to threading. There is no simple solutions when it comes to threading, and here you would have SDL Qt and OpenGL mainloop interacting. Not fun.

最簡單、最明智的解決方案是將兩個部分解耦.這樣 SDL 和 Qt 在不同的進程中運行,并讓它們使用某種消息傳遞進行通信(我在這里推薦 d-bus ).您可以將 SDL 渲染到無邊框窗口中,并且您的編輯器通過消息發送命令.

The easiest and sanest solution would be to decouple both parts. So that SDL and Qt run in separate processes and have them use some kind of messaging to communicate (I'd recommend d-bus here ). You can have SDL render into borderless window and your editor sends commands via messages.

這篇關于如何同時使用 Qt 和 SDL?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 日韩精品一区二区三区中文字幕 | eeuss国产一区二区三区四区 | 国产午夜精品视频 | 在线免费观看毛片 | 久久av资源网 | 久久tv在线观看 | 亚洲97| 亚洲第一网站 | 国产精品久久久久久久久久久久久久 | 免费欧美 | 91在线观看视频 | 久久久成人免费一区二区 | 在线2区 | 日韩高清在线 | 久免费视频 | 在线国产中文字幕 | 亚洲久久久 | 亚洲成人精品一区二区 | 国产欧美精品一区二区三区 | 色av一区 | 亚洲一区二区免费 | 精品免费国产 | 天天干视频 | 午夜精品一区二区三区在线视频 | 国产目拍亚洲精品99久久精品 | 欧美精品首页 | 精品久久久久久亚洲精品 | 日韩精品视频一区二区三区 | 欧州一区二区三区 | 欧美理伦片在线播放 | 久久高清 | 久久久性色精品国产免费观看 | 国产精品欧美一区二区三区不卡 | 国产日韩欧美一区 | 亚洲不卡一 | 精品国产一区二区国模嫣然 | 国产美女一区 | 亚洲免费精品一区 | 欧美中文字幕一区二区 | 欧美精产国品一二三区 | 欧美理论在线观看 |