[Qt-interest] Stacked QGraphicsViews
Ryan McDougall
sempuki1 at gmail.com
Wed Feb 3 18:18:06 CET 2010
We do this for the UI in our game: http://code.google.com/p/realxtend-naali/
It's only one "layer" the GUI one, and we don't use QGL (rather
Ogre3D), but the idea is to draw your layers to a QImage, blit the
image to a texture on the GPU, composite on the GPU, then display over
the 3D scene.
No doubt it's easier with QGL.
Cheers,
On Wed, Feb 3, 2010 at 7:02 PM, Cyril <cyril.mailing.list at gmail.com> wrote:
> Hi all
>
> I am trying to find a simple and efficient way of "cascading" several
> graphicsviews so they draw their contents on one same (possibly OpenGL)
> viewport and still.
> The goal is to have a few different "transparent layers" on top of each
> other, each layer having its own scene and its own transform, and reacting
> to user input with specific rules.
> The ordering is important since drawing should occur from the bottom-most
> layer up to the top-most layer. Same for user input (in opposite order
> though): it should be caught by the top-most view first, and then bubbled
> down to the second layer if necessary, and so on.
> One might think of a game viewport, composed of a game view, staked under a
> HUD, stacked under a kind of "menu" overlay.
>
> When it comes to implementation, I have thought of mainly the two following
> approaches :
>
> 1. Having one master qgraphicsview, then adding qgraphicsproxywidgets on it,
> each of them wrapping a qgraphicsview, simply setting the proper z-order.
>
> 2. Stacking qgraphicsviews myself on a viewport widget, doing event handling
> myself, bubbling the user input events myself, calling
> QGraphicsView::render() myself in the right order, and hoping for the best.
> This solution is a lot more tricky but offers a lot more control over what's
> going on, especially in terms of QPainters creations/destructions. There may
> be a lot of caveats going for that one. Not to mention windowing issues.
>
> What may be the best way to go? Are there showstoppers you guys see?
> The main reason I want to try a multiple-graphicsview solution is that each
> layer should be independent in terms of view transformation. It may also be
> nice to simply turn on the drawForeground() method of one of them with a
> semi-transparent brush to get the lower layers grayed ; and lots of other
> nice features.
>
> Would love to have your opinions!
> Regards
> Cyril
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
More information about the Qt-interest-old
mailing list