mpellegr
mpellegr

Reputation: 3182

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. 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. I'd also like to be able to send data from the OpenGL application into the Qt application and back.

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?

I found a few links that may be helpful, but at this point they are way over my head and I need some guidance:

Upvotes: 0

Views: 562

Answers (2)

tharibo
tharibo

Reputation: 278

I have no idea how it would be possible with two applications on 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. 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. 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. It's even possible to have a QGraphicsView on top of OpenGL and to use QML. However, you may have bad performance if you use too much transparency.

Upvotes: 1

anotherdev
anotherdev

Reputation: 2569

If you want to share textures, vbo etc... that are manipulated by OpenGL, then each context MUST be created in the same application.

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

Upvotes: 2

Related Questions