Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QGLWidget Methods Not Called (InitializeGL, PaintGL, resizeGL)
Forum Updated to NodeBB v4.3 + New Features

QGLWidget Methods Not Called (InitializeGL, PaintGL, resizeGL)

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 5.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hornsj2
    wrote on 14 Apr 2011, 15:44 last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Merinas
      wrote on 15 Apr 2011, 07:39 last edited by
      #2

      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.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hornsj2
        wrote on 15 Apr 2011, 09:55 last edited by
        #3

        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 Reply Last reply
        0

        1/3

        14 Apr 2011, 15:44

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved