简体   繁体   English

是否将OpenGL应用程序与Qt集成?

[英]Integrating OpenGL application with Qt?

I'm new to using OpenGL and don't know how the gl contexts and such work so bear with me. 我是使用OpenGL的新手,并且不知道gl上下文和此类工作原理是如何承受的。 I have an application written in C++ using OpenGL for Linux that I want to be able to keep running on my machine in full screen mode, and then I want to create another application in Qt to render on top of the same window the other application is rendering to. 我有一个使用OpenGL for Linux用C ++编写的应用程序,我希望能够在全屏模式下继续在我的机器上运行,然后我想在Qt中创建另一个应用程序以在另一个应用程序位于同一窗口的顶部进行渲染渲染到。 I'd also like to be able to send data from the OpenGL application into the Qt application and back. 我还希望能够将数据从OpenGL应用程序发送到Qt应用程序中,然后再发送回来。

How can I accomplish these tasks, and would it be advisable to keep the applications separate, or is it easier to potentially have Qt wrap the other application's gl context? 我该如何完成这些任务,建议将应用程序分开放置,还是让Qt封装另一个应用程序的gl上下文更容易?

I found a few links that may be helpful, but at this point they are way over my head and I need some guidance: 我发现了一些可能有用的链接,但目前它们已经超出了我的理解范围,我需要一些指导:

If you want to share textures, vbo etc... that are manipulated by OpenGL, then each context MUST be created in the same application. 如果要共享由OpenGL处理​​的纹理,vbo等...,则必须在同一应用程序中创建每个上下文。

Else, if you want to send others datas to the other application, it's an IPC case, you can read http://en.wikipedia.org/wiki/Inter-process_communication 否则,如果您要将其他数据发送到另一个应用程序,这是IPC案例,则可以阅读http://en.wikipedia.org/wiki/Inter-process_communication

I have no idea how it would be possible with two applications on Linux. 我不知道在Linux上使用两个应用程序怎么可能。 On Windows, I know that it isn't really possible, in the sense that you would have the Windows bar at the bottom of the screen, and you would have to force the QT windows to stay on top of everything. 在Windows上,我知道这实际上是不可能的,因为您会将Windows栏置于屏幕底部,并且必须强制QT窗口保持在所有内容的顶部。 This is not very practical, but it may do if these are the only two applications running. 这不是很实用,但是如果只有两个运行的应用程序可以这样做。

Another solution with two applications would be to run the OpenGL one in a borderless-titlebarless window, set to the size of the screen resolution. 具有两个应用程序的另一种解决方案是在无边界的无标题窗口中运行OpenGL,并设置为屏幕分辨率的大小。 But you would still have to manage the second applications windows to stay on top of the first one, still not practical. 但是您仍然必须管理第二个应用程序窗口以保持在第一个应用程序窗口之上,这仍然不切实际。

So, from the context you're drawing, it seems that the best solution would be to create only one application. 因此,从您绘制的上下文来看,最好的解决方案似乎是仅创建一个应用程序。 Using QT, you can render some OpenGL and some QWidgets on top of it. 使用QT,您可以在其顶部渲染一些OpenGL和一些QWidget。 It's even possible to have a QGraphicsView on top of OpenGL and to use QML. 甚至有可能在OpenGL上有一个QGraphicsView并使用QML。 However, you may have bad performance if you use too much transparency. 但是,如果使用过多的透明度,则可能会导致性能下降。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM