[Interest] Qt 5.4 Beta with Qt3D's QGLPainter

Sean Harmer sean.harmer at kdab.com
Sat Nov 22 12:14:56 CET 2014


On 20/11/2014 16:32, Jonathan Poncelet wrote:
> Hi all,
>
> I'm attempting to use the QGLPainter from Qt3D with Qt 5.4's new 
> QOpenGLWidget - I was originally making do with QGLWidget from the 
> previous Qt version but I was running into trouble with putting 
> widgets, buttons, etc. on top of the GL widget, which is something I 
> need to do. I'm fairly familiar with the Qt3D library but not so much 
> on the in-depth side, and right now if I call begin() on a QGLPainter 
> I create in the QOpenGLWidget's paintGL() function, I get the 
> following messages output before the program crashes:
>
> /Attempt to cast non-window surface/
> /Attempt to activate GL window surface on bad context/
> /
> /
> I've tried various things - calling begin() and passing the widget's 
> GL context doesn't have any effect, and the function won't accept the 
> context's QSurface as it's expecting a QGLSurface. Is there any way to 
> get QGLPainter working with the new QOpenGLWidget, or will I have to 
> stick with QGLWidget?
The old Qt3D is no longer being developed or maintained so please do not 
use it. We are busy rewriting Qt3D but in it's current state it is not 
possible to overlay widgets over a Qt3D window. This is in the feature 
roadmap however.

It sounds like you just need to use QOpenGLWidget which allows 
compositing widgets on top of the contained OpenGL content. 
Alternatively if you want to overlay Qt Quick 2 UI on top of GL you can 
use the QQuickWindow::beforeRendering() signal. See the openglunderqml 
example to see how to do this.

Cheers,

Sean

-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141122/888950f2/attachment.html>


More information about the Interest mailing list