Results 1 to 2 of 2

Thread: QT application with opengl and GLU

  1. #1
    Join Date
    Apr 2006
    Location
    Saint-Petersburg, Russia
    Posts
    63
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default QT application with opengl and GLU

    Hello !

    I try to make QT application with OpenGL graphics. I subclass QGLWidget and try draw cylinder such this
    Qt Code:
    1. #include <QDebug>
    2. #include <QMouseEvent>
    3.  
    4. #include <GL/glu.h>
    5. #include <GL/glu_mangle.h>
    6.  
    7. #include "glwidget.h"
    8.  
    9. ...
    10.  
    11. void GLWidget :: paintGL (void)
    12. {
    13. qDebug () << __FUNCTION__;
    14. glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    15. GLUquadricObj* q = new gluNewQuadric ();
    16. gluCylinder (q, (GLdouble)cyl_radius, (GLdouble)cyl_radius, (GLdouble)cyl_height, 1000, 1000);
    17. }
    To copy to clipboard, switch view to plain text mode 
    and I receive an error
    glwidget.cpp: In member function ‘virtual void GLWidget:aintGL()’:
    glwidget.cpp:59: error: expected type-specifier before ‘mgluNewQuadric’
    glwidget.cpp:59: error: cannot convert ‘int*’ to ‘GLUquadricObj*’ in initializat
    ion
    glwidget.cpp:59: error: expected ‘,’ or ‘;’ before ‘mgluNewQuadric’
    glwidget.cpp:60: error: ‘mgluCylinder’ was not declared in this scope
    make: *** [glwidget.o] Error 1
    (3 of 7): error: expected type-specifier before ‘mgluNewQuadric’
    In pro-file I write
    Qt Code:
    1. DEPENDPATH += . \
    2. /usr/include/GL
    3. INCLUDEPATH += . \
    4. /usr/include/GL
    5.  
    6. QT += opengl
    7.  
    8. ...
    To copy to clipboard, switch view to plain text mode 
    My platform is Gentoo Linux, QT was compiled with opengl support. Any ideas ?
    Best regards,
    Yuriy Rusinov.

  2. #2
    Join Date
    Apr 2006
    Location
    Saint-Petersburg, Russia
    Posts
    63
    Thanks
    15
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QT application with opengl and GLU

    I'm sorry, error was in
    Qt Code:
    1. GLUquadricObj* q = new gluNewQuadric ();
    To copy to clipboard, switch view to plain text mode 
    ,
    I have to write
    Qt Code:
    1. GLUquadricObj* q = gluNewQuadric ();
    To copy to clipboard, switch view to plain text mode 
    Best regards,
    Yuriy Rusinov.

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.