PDA

View Full Version : 4 openGL viewports



winder
21st February 2010, 13:06
Hello

i would like to know which is the best approach in creating multiple openGL viewports, (for the same scene), with each viewport being in a separate widget, tha can be resized etc... You know.. sth every 3d modeling program does... like 3ds max for example.

Thanks in advance

codeslicer
21st February 2010, 15:42
A QGraphicsScene can be viewed by multiple QGraphicsViews. So just create 4 QGraphicsViews, and on each one do:

setViewport(new QGLWidget());

~codeslicer

winder
22nd February 2010, 01:06
Thanks man! Short but very helpful! :)

winder
22nd February 2010, 14:08
I managed to setup the 4 viewports, after having a look at this... http://qt.gitorious.org/qt-labs/modelviewer

It uses a graphicsScene, and graphicsViews hust like codeslicer proposed.

The thing is tha now i'm a bit confused about how to manage the scene, and how to display the scene content depending on which View is currently active. In the modelviewer app, everything is drawn in the function drawBackground() of the class GraphicsScene. But i obviously i need sth more flexible...

So how can i use , these 3 classes... GraphicsScene, GraphicsView, QGLWiddet....(or derived classes), to achieve what i want?

thanks in advance