PDA

View Full Version : Redrawing QGLWidget with 3D+2D graphics



bmpix
17th July 2010, 09:54
Hi,

I have a QGLWidget which draws both 3D and 2D graphics (just like in Qt's example 'overpainting').
The thing is after I started drawing 2D graphics (moved code from paintGL() to paintEvent(), etc.), the widget stopped redrawing most of the times. It didn't redraw after resiging, after loading, and so on. I put repaint() calls, it helps in some cases, but doesn't help in e.g. resizing.
So which function should I use to refresh the widget? update() or updateGL() or repaint()? Or maybe there is a way to set some mode to enable automatic redrawing after resizing/load/...?

Thanks.

Conejoo
1st October 2012, 04:36
Hello, i'm facing the same problem and i have tried to fix it for several hours. Were you able to fix it?
Thanks

d_stranz
1st October 2012, 20:10
Did you read the documentation for QGLWidget::paintEvent()? Did you look at the Overpainting example? Are you calling QGLWidget::paintGL() first from within your own code, and then issuing your QPainter calls? Or if your OpenGL calls are in the paintEvent itself, are you calling the OpenGL methods first before doing the overpainting? Do you call makeCurrent()? initializeGL()?