QGLWidget Methods Not Called (InitializeGL, PaintGL, resizeGL)
-
wrote on 14 Apr 2011, 15:44 last edited by
I'm doing some R&D on QML for a project.
My goal is to render to an OpenGL window, with QML GUI elements on top of it. I understand it to be the case that you need to subclass a QDeclarativeItem, where the OpenGL calls go. Then, create a QDeclarativeView and set an OpenGL widget as the viewport for that view.
I have done the following:
@
//Main.cpp
QGLFormat format;
format.setVersion(4,0);
format.setProfile(QGLFormat::CoreProfile);
format.setDefaultFormat(format);QApplication app(argc, argv);
qmlRegisterType<Declare>("DeclarePlugins", 1, 0, "Declare");
QDeclarativeView view;
glWidget* aGLwidget = new glWidget(format);
view.setViewport(aGLwidget);
view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
QDeclarativeContext *context = view.rootContext();
view.setSource(QUrl::fromLocalFile("samegame.qml"));
view.show();return app.exec();
@I sublclassed QGLWidget to be able to set breakpoints. This is the glWidget you see above.
The issue I'm seeing is that although the drawing code in the QDeclarativeItem works, the breakpoints in the QGLWidget's paint, initialize, and resize methods are never reached.
Is this as intended?
Edit: fixed code indentation for improved code readability; Andre
-
wrote on 15 Apr 2011, 07:39 last edited by
I've succeed in drawing OpenGL with QML you could look at "that topic":http://developer.qt.nokia.com/forums/viewthread/4109/ to see how I've done.
-
wrote on 15 Apr 2011, 09:55 last edited by
Thank you for the response. I've done that too. It doesn't address why I can't break at the QGLWidget's internal functions if it is used as the viewport.
I've looked briefly at QGLView, which is in 4.8. It looks like that might be a good place for me to start.
1/3