Results 1 to 2 of 2

Thread: how to use glutMouseFunc

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2017
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default how to use glutMouseFunc

    i use QT and am programming for a Native program which draw figures(like triangles) and user can select one of the figures and the figures can be changed.
    so i want to use glutMouseFunc, searched google and found this source.

    https://www.opengl.org/archives/reso...ok/pickdepth.c

    and i am making [QT Widget App] which use Mainwindow and my code is just this.
    but it's not working.
    what's the Reason?
    i want to know the usage.


    //maint.cpp
    int main(int argc, char *argv[])
    {
    glutInit(&argc, argv);

    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
    }




    //openglwidget.cpp, it use QOpenGlView of QT UI
    void pickRects(int button, int state, int x, int y)
    {
    qDebug()<<"pickRects";
    printf("pickRects\n");
    }

    OpenGLWidget::OpenGLWidget(QWidget *parent): QGLWidget(parent)
    {
    glutMouseFunc(pickRects);
    }

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to use glutMouseFunc

    What is not working? What would you expect your code to be doing? You don't have any GLUT windows so obviously the callback is never called.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.