hi guys :)

I’m writing a 3d model viewer, so basically I want to pass my glview
to QML to use it as an element and add the rest of the UI with QML…

My current problem is that only the element which represents my glview
(a custom QDeclarativeItem with reimplemented paint() with OpenGLES
2.0 calls) is shown, the rest (2 toolbars and some more) is all black.

But when I hit the buttons on the (black) toolbar (or scroll a
listview) those elements are shown, flickering with black, as if they
were trying to get the top view but the black layer was trying to
cover them again.

I have tried changing the setViewportUpdateMode, and that doesn’t help
(I have tried all values)…unless I set it to FullViewportUpdate, in
which case the UI is always repainted and FPS goes from 36 (with the
3D model viewer and all the rest under the black layer) to 22!!

So what I’d like to accomplish is: get what is inside my custom QML
element (QDeclarativeItem) repainted (i.e. the 3D Model), without
repainting the rest of the elements of the UI (toolbars, etc) because
that is useless and eats a lot of FPS…but without painting black over
all the UI elements (as it currently does)!

can you guys help me out? :)

Here’s the setup of my app

    QApplication::setGraphicsSystem("opengl");
    Q_INIT_RESOURCE(common);
    qmlRegisterType<modelviewer>("Test", 1, 0, "Viewer");
    QScopedPointer<QApplication> app(createApplication(argc, argv));
    QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());

    viewer->setResizeMode(QDeclarativeView::SizeRootObjectToView);

    QGLWidget* renderer = new QGLWidget();

    //if setAutoFillBackground is true I get the 3D model painted, and
the rest is all WHITE, if it is false, the 3D Model is painted, and
the rest is all BLACK
    renderer->setAutoFillBackground(false);
    viewer->setViewport(renderer);

    viewer->setAttribute(Qt::WA_OpaquePaintEvent);
    viewer->setAttribute(Qt::WA_NoSystemBackground);
    viewer->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    viewer->viewport()->setAttribute(Qt::WA_NoSystemBackground);

    viewer->setMainQmlFile(QLatin1String("qml/main2.qml"));


Thanks in advance to anyone who will try to help me :)
_______________________________________________
Qt-qml mailing list
Qt-qml@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to