[Qt-interest] When OpenGL Initialization happens? (QGraphicsScene - OpenGL glBegin/glEnd)
Samuel Rødal
sroedal at trolltech.com
Thu Apr 16 10:28:44 CEST 2009
fungos wrote:
> Ok, but when we use _only_ QGraphicsView + QGraphicsScene, it does use
> QGLWidget internally? How can I then call makeCurrent when holding
> only QGraphicsView and/or QGraphicsScene?
If you want QGraphicsView to render using OpenGL you need to explicitly
call QGraphicsView::setViewport() with a QGLWidget, like this:
QGraphicsView view;
...
QGLWidget *widget = new QGLWidget;
view.setViewport(widget);
And then you can do widget->makeCurrent() and do the initialization that
you require.
I suggest you read this Qt Quarterly article for more information on how
to mix OpenGL and QGraphicsView:
http://doc.trolltech.com/qq/qq26-openglcanvas.html
--
Samuel
More information about the Qt-interest-old
mailing list