1 Attachment(s)
Embedding SDL as a Widget
For a while I've been using SDL to write my 3D engine,and have recently been implementing an editor that can export an optimized format for the type of engine Im building. Right now the editor is fairly simple, objects can just be moved around and their textures and models can be changed. As of right now, I'm using SDL with OpenGL to render everything, but I want to use Qt for the GUI part of the editor, that way it looks native on every platform. I've got it working great so far, I'm running a QApplication inside of the SDL application, so it basically just opens 2 windows, one that uses SDL and OpenGL, and the other using Qt. Doing a bit of research, I've found that you can manually update a QApplication, which totally removes any threading problems, and everything works. Just in case you're having a hard time visualizing this, heres a picture:
Attachment 10787
What my goal is to merge these windows into one, because on smaller screens (like my laptop's) it makes it really hard to keep track of all the different windows that I would eventually have. I know theres a way to render to Qt with OpenGL, but can this be integrated with SDL? Am I going to need to move away from using an SDL window and use a QT one if the editor is enabled? Just to clarify, when the engine isn't in editor mode, it won't use and Qt, just SDL, so optimally I wouldn't need to do this.
Thanks
Re: Embedding SDL as a Widget
If you can get a window handle for the SDL window, then you should be able to wrap it in a QWindow using QWindow::fromWinId().
This should then be embedable with QWidget::createWindowContainer().
Cheers,
_
Re: Embedding SDL as a Widget
Quote:
Originally Posted by
anda_skoa
Doesn't this function only work on Windows though? I want to use it for Mac and Linux as well. (The docs say nothing about it)
Re: Embedding SDL as a Widget
I did a quick search in the Qt sources and it appears that "ForeignWindows" are supported by the platform modules Android, Windows and XCB.
Might indeed not work on OS X.
You might have to look into integration the OpenGL rendering more directly.
E.g. https://www.youtube.com/watch?v=BfIaTccy6HQ
Cheers,
_