General guidance for opengl application with embedded UI
-
I want to port my application from qglwidget and opengl 1.2 to the new opengl 3+. I want a single window with qwidget controls that i've already developed, and an opengl rendering area: all under 1 top level window.. But so far i've had challenges finding a good general approach to take that is simple, at least as simple as my present implementation. I am interested in hearing what directions i should head in. Here are the options i've looked at so far.
- qml with a special pair of c++ qobject rendering classes. This follows the squircle pattern where i have UI in qml, and properties are communicated to c++ qobjects. My concern in this approach is i don't fully feel comfortable with the multi-threading involved. I am concerned with facing multi-threading issues when the various property changes occur. Maybe it's not that dangerous.
- qwindow interface patterned after the opengl triangle example. I like this starting point in terms of simplicity, but I have so far not been able to find a way to add qwidget's into the same window as the opengl rendering. I've tried the QtWidget::createWindowContainer as a way to make the opengl window a qwidget that i can add buttons to, but the buttons never appear. I think that may be due to painting order but not sure.
- The second-best is to give up and use this approach but have a free-standing window for opengl rendering and and a seperate window for GUI controls. I might be able to get window managers to help keep the 2 windows side-by-side.
- I can continue to use the qglwidget, but i'm not sure if there are problems with the opengl versions when i continue to use qglwidget. I did see on linux where mouse events that call for repaints seem to back up. It appeared like there is some type of new repainting that maybe forcing a 60 fps redraw but that is just conjecture on my part.
So again, i'm just looking for guidance /experienced approaches that others have taken with qt 5.3> = that has GUI and opengl under a single window, and the opengl is >=3.