PDA

View Full Version : QgraphicsScene on QGLWidget background



ksrini
24th October 2009, 17:42
Hi,

I have a QgraphicsScene that renders some animation using QPropertyAnimation.
I would now like to place a QGLWidget in the background which renders its own animation using opengl APIs.
I want both these animations to appear simultaneously. How do I go about doing this?
I found posts and examples that tell me how to overpaint over QGLWidget using QPainter and others that tell me how to make the QGraphicsView transparent.
But I want to use my existing animation code that uses QgraphicsScene with QPropertyAnimation and be able to plugin my opengl animation in the background.
If I simply set the viewport on the QGraphicsView to my QGLWidget both the animations appear with some flickering and when the animation on my QgraphicsScene stops, only the gl animation is visible.

I would appreciate any help here to enable me to do it the right way. Preferably with some sample code. :)

Thanks,

axeljaeger
25th October 2009, 00:56
See http://qt.nokia.com/doc/qq/qq26-openglcanvas.html

ksrini
30th October 2009, 10:57
See http://qt.nokia.com/doc/qq/qq26-openglcanvas.html
Thank you! That was useful. I was able to achieve what I was trying to do. I do have some issues though, which I would attribute to possible errors in my code.
I'm kind of new to Qt and Opengl. One issue that I face is, the animation rendering on my graphics scene (not my opengl background) flickers a lot but it doesnt disappear. How can I get rid of the flicker? I know it maybe hard for you to guess what I could be doing wrong without seeing my code, but I just thought it maybe a common issue that you could remember from the top of your head.