Sat, 03/15/2014 - 15:21
Hello,
I think adding transparent UI into the viewer is essential for CAD applications (HUD display, ocaf tree ect)
So I am trying to add transparent Qt widgets on the OpenGl viewer.
According to this http://doc.qt.digia.com/qq/qq26-openglcanvas.html you need to:
1. Subclass QGraphicsScene.
2. reimplement drawBackground() function.
3. Render your OpenGl scene in drawBackground().
4. Add transparent widgets to the scene.
This is straight forward except for step 3. drawBackground requires you to put in your (pure) OpenGl commands (Not view->Redraw(); )
So the question is, How can we render the viewer inside drawBackground(); ?
Is there a function that can be used to render like it does in the example?
I have attached a simple project of how it should be used.
Thank you
Sat, 03/15/2014 - 15:27
I'm very curious about this as well Daniel...
Have you seen [1]?
It mentions getting the OGL context, which perhaps might be the gateway to this?
-jelle
[1] http://www.opencascade.org/org/forum/thread_25912/?forum=3
Sat, 03/15/2014 - 15:42
Yes that may be a possibility, I am looking into it.
Thanks Daniel
Tue, 03/18/2014 - 00:03
You might also consider using a FBO, especially if you are going to use Qt::WA_TranslucentBackground.
---------
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
---------
Because if you add this lines to any widget, OpenGL content would not be properly displayed.