stschindler
stschindler

Reputation: 937

Embedding Qt GUI into existing OpenGL program

I'm currently trying to get Qt working with my existing program.

I'm using SFML for creating my OpenGL rendering context and creating the window. The things I tried out so far however always create a separate window by Qt instead of just rendering into the existing context.

Is there any way I can force Qt to render to an already existing OpenGL context?

Upvotes: 5

Views: 2314

Answers (2)

bobbaluba
bobbaluba

Reputation: 3904

I've not looked into the specifics, but this has been done for openage.

I think looking at the documentation for QQuickRenderControl might be a good place to start.

Upvotes: 4

datenwolf
datenwolf

Reputation: 162337

Qt wants full control over the windows and the event loop, so this will not work (unless you put a lot of effort into it). Your best bet is using a QGLWidget and emulate the event management of SFML with that, so that your application effectively runs on Qt. It is very well possible to render Qt widgets into a OpenGL window (Qt has a OpenGL widget backend) but this must be still managed by Qt itself.

Upvotes: 2

Related Questions