[Interest] Rendering to QGLWidget with QGLPainter

Jonathan Poncelet jonathan.poncelet at talk21.com
Sun Jul 6 02:29:26 CEST 2014


I'm attempting to create a widget which is half way between QGLWidget and Qt3D's QGLView - I'd like to be able to utilise the rendering functions of QGLBuilder/QGLPainter/etc. from the Qt3D library but I'd rather not be restricted to a window - I want to be able to draw to widgets and to shift these around in window layouts.

For the most part I've been copying functions from the QGLView and merging them into a QGLWidget subclass - I have a QGLCamera set up for use, and when initializeGL()/paintGL() are called from QGLWidget I use a QGLPainter to call more specific initializeGL(QPainter*) and paintGL(QPainter*) functions like QGLView does. However, I cannot push the widget's surface onto the QGLPainter as I don't seem to be able to get a surface from the QGLWidget to begin with.

voidOpenGLWidget::paintGL()
{
//Paintthescenecontents.
QGLPainterpainter();
painter.begin();

painter.pushSurface(/*Somesurfaceneedstogohere!*/);
painter.setEye(QGL::NoEye);
earlyPaintGL(&painter);
painter.setCamera(camera());
paintGL(&painter);
painter.popSurface();
}

The QGLPainter documentation is not very helpful as the description is just "Lots TBD". Can anyone tell me why it's not straightforward to use a QGLPainter on a QGLWidget? Is there any way to get around it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140706/375ff454/attachment.html>


More information about the Interest mailing list