QGLWidget Methods Not Called (InitializeGL, PaintGL, resizeGL)
-
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
-
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.
-
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.