[Qt-interest] QGraphicsView and OpenGL rendering artifacts on Mac OS X

John Clayton (gmail) johnclayton72 at gmail.com
Sun Aug 9 13:01:27 CEST 2009


Hi All,

I'm rendering a quad into a scene via opengl, and have a redraw issue  
that I [so far] haven't been able to track down, or solve.

The Problem:
When resizing the opengl based qgraphicsview - the newly exposed edges  
are filled with rubbish before finally being redrawn correctly.  In  
this case, the non-scientifically measured delay before the view is  
finally redraw is somewhere in the vicinity of 200 milliseconds (i.e.  
gut feel).

My Questions:
1) Why am I seeing redraw artifacts in a double-buffered GL view?
2) Why does the view eventually redraw itself correctly after what  
feels like 200-ish milliseconds.

I've got a couple of screen shots in a gallery, showing the results of  
these artifacts.  The artifacts show up when the GL content is resized  
via a QSplitter - I don't know if having the OpenGL based  
QGraphicsView embedded in a splitter is the cause of this.  The track  
view in the shots redraws correctly all the time, but its not open-gl  
based.

Has anyone encountered something like this before, if so - any ideas  
how I can fix it?

the code to set up the previewView (QGraphicsView) is as follows:

     QGLFormat fmt;

     PreviewGLWidget* viewport = new PreviewGLWidget(fmt);
     _ui->previewView->setViewport(viewport);

     viewport->makeCurrent();

     _contentLoader = new ContentLoaderController(_document->project,  
viewport);
     _previewScene = new PreviewScene(_document, _contentLoader);

     _ui->previewView- 
 >setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
     _ui->previewView->setDragMode(QGraphicsView::ScrollHandDrag);
     _ui->previewView->setCacheMode(QGraphicsView::CacheNone);
     _ui->previewView->setResizeAnchor(QGraphicsView::AnchorViewCenter);
     _ui->previewView- 
 >setTransformationAnchor(QGraphicsView::AnchorViewCenter);
     _ui->previewView->setAlignment(Qt::AlignCenter);
     _ui->previewView- 
 >setRenderHints(QPainter::HighQualityAntialiasing |  
QPainter::SmoothPixmapTransform);
     _ui->previewView->setScene(_previewScene);
     _ui->previewView->setBackgroundBrush(Qt::black);
     connect(_previewScene, SIGNAL(selectionChanged()), this,  
SLOT(slotPropagatePreviewSelectionStateToTrackView()));

Any tips appreciated, thanks for your time/help.

--
John Clayton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090809/d62496b2/attachment.html 


More information about the Qt-interest-old mailing list