[Interest] QGLContext rendering in a native window
Thomas Sevaldrud
thomas at silentwings.no
Thu Jan 30 12:51:17 CET 2014
Hi,
I'm trying to use QGLContext to render into a native Win32 window, and I'm
wondering what'ts the best way to do this. What I've done this far is the
following:
Given a natively created window with a valid HWND, I Create a QWindow with
the following parameters:
setSurfaceType(QWindow::OpenGLSurface);
setFlags(Qt::ForeignWindow);
setProperty("_q_foreignWinId", QVariant::fromValue((WId)hwnd));
The native window is already open, but I need to call show() on the QWindow
to trigger the Qt native window structures.
After this, I can create a QGLContext and make it current in the custom
QWindow, and I can even render to it, but I get a lot of warnings like these
QOpenGLContext::swapBuffers() called with non-exposed window, behavior is
undefined
It appears that the "exposed" flag is never set in the custom QWindow.
Any ideas how I can fix this? I can't find any convenient way to force the
expose flag in a QWindow. Or is there a cleaner way to achieve this?
Best regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140130/3e80e510/attachment.html>
More information about the Interest
mailing list