[Qt-interest] QGraphicsFramework - OpenGL - Invalidate Problem
Simone Artesino
mlist.sa at gmail.com
Fri Apr 17 17:00:02 CEST 2009
Hi to everybody, could anyone help me?
We are using an x86 architecture with intel graphic card, running Gentoo and
QT. We are sure that the drivers for the graphic card are correctly
configured.
This is my context: i'd like to render an openGL application made of a big
static texture background surrounded by a rotating objects. To do that in a
optimized way i like to use QGraphicsFramework, and encapsulate the
background into QGraphicsScene::BackgroundLayer and the rotating objects
(which are the one animated) into QGraphicsScene::ForegroundLayer. In this
way I'd like to animate my Game-Application by redrawing only the
ForegroundLayer.
What's not clear to us is:
1)which ViewportUpdateMode we have to use? We have tried with the "
NoViewportUpdate", but as a results the rotating objects doesn't run, it's
like that after the foreground has draw itself, something is blocking its
visualization into the final widget.
2)On the other hand if we use MinimalViewportUpdate, then it results in very
poor performance like we are always redrawing the full scene: background +
foreground.
3)We have so far implemented a version, which try to use the invalidate
method, so that we can redraw only the Foreground layer and specially a
bounding rectangle, but we still have the same very poor performances...How
do we have to set QRectF() in the invalidate function?
Belove we have reported a code example...
//***in main.cpp I create the QGraphisView and set as default viewport a
QGLWidget
QGLWidget *widget = new QGLWidget(QGLFormat(QGL::Rgba |
QGL::SampleBuffers));
QGraphicsView view;
view.setViewport(widget);
//1) Questions: which ViewportUpdateMode i have to use? We have tried with
the
"NoViewportUpdate
"view.setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
//***in myscene.cpp i instantiate the Qtimeline, correctly set background
and foreground layer, and set the code for animation (i want to update only
the
QTimeLine m_timeline=new QTimeLine(timeLineTime,this);
void myScene::drawBackground(QPainter *painter, const QRectF &)
{
//OPEN GL code for drawing the background
}
void myScene::drawForeground(QPainter *painter, const QRectF &)
{
//OPEN GL code for drawing the rules }
}
connect(m_timeline, SIGNAL(frameChanged(int)), this , SLOT(animate()));
void myScene::animate{
//some opengl code
invalidate(QRectF(),QGraphicsScene::ForegroundLayer);
}
4)Am'I doing the right things? Are there any other techniques for introduce
a layer concept within openGl and Qt?
thankU for any kinds of help
-Arte- Simone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090417/62c39626/attachment.html
More information about the Qt-interest-old
mailing list