Results 1 to 15 of 15

Thread: OpenGL Issue

  1. #1
    Join Date
    Feb 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default OpenGL Issue

    I am having a problem using OpenGL. I included opengl in the pro file and put the include <QtOpenGL> but it is telling me that it cannot find OpenGL/gl.h

    Qt Code:
    1. #include "openglpanel.h"
    2. #include <QtOpenGL>
    3.  
    4. //Define the methods up top.
    5. void OpenGLPanel::initializeGL(){}
    6. void OpenGLPanel::resizeGL(int x, int h){}
    7. void OpenGLPanel::paintGL(){}
    8. void OpenGLPanel::changeSides(int s){}
    9. void OpenGLPanel::changeRadius(double r){}
    10.  
    11. OpenGLPanel::OpenGLPanel(QWidget *parent) :
    12. QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
    13. {
    14. sides = 3;
    15. radius = 1.0;
    16.  
    17. }
    18.  
    19. void OpenGLPanel::initializeGL()
    20. {
    21. qglClearColor(qtPurple.dark());
    22.  
    23. glEnable(GL_DEPTH_TEST);
    24. glEnable(GL_CULL_FACE);
    25. glShadeModel(GL_SMOOTH);
    26. glEnable(GL_LIGHTING);
    27. glEnable(GL_LIGHTO);
    28. glEnable(GL_MULTISAMPLE);
    29. static GLgloat lightPosition[4] = {0.5, 5.0, 7.0, 1.0};
    30. glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
    31. }
    To copy to clipboard, switch view to plain text mode 


    I am running OSX and as far as I know, OpenGL is installed by default. Any help is appreciated.

  2. #2
    Join Date
    May 2008
    Location
    Tripoli Libya
    Posts
    70
    Thanks
    10
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: OpenGL Issue

    add this line to your pro file
    QT += opengl

  3. #3
    Join Date
    Feb 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL Issue

    Already in there.

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

    Default Re: OpenGL Issue

    You are missing OpenGL development files for your system. This has nothing to do with Qt.
    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.


  5. #5
    Join Date
    Feb 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL Issue

    How do I install the dev files?

    OpenGL should be installed by default, but I suppose the dev files are not.

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

    Default Re: OpenGL Issue

    Quote Originally Posted by Wnt2bsleepin View Post
    How do I install the dev files?
    I have no idea. I'm sure that if you ask this question to your favourite web search engine, it will come up with a number of solutions.
    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.


  7. #7
    Join Date
    May 2008
    Location
    Tripoli Libya
    Posts
    70
    Thanks
    10
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: OpenGL Issue

    Quote Originally Posted by Wnt2bsleepin View Post
    How do I install the dev files?

    OpenGL should be installed by default, but I suppose the dev files are not.
    http://cacs.usc.edu/education/cs596/ogl_setup.pdf
    http://www.opengl.org/

  8. #8
    Join Date
    Feb 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL Issue

    Those work with XCode. I compiled and ran the one example and it worked fine. Both OpenGL and Glut are installed.

    How do I get it to work with QtCreator? Is there a way to define where the headers/frameworks are?

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

    Default Re: OpenGL Issue

    Quote Originally Posted by Wnt2bsleepin View Post
    Is there a way to define where the headers/frameworks are?
    Yes. You can use the INCLUDEPATH variable in your project file.
    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.


  10. #10
    Join Date
    Feb 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL Issue

    Apparently a .framework file also contains its own folders, so linking to those directly doesn't work

    Qt Code:
    1. INCLUDEPATH += /System/Library/Frameworks/
    To copy to clipboard, switch view to plain text mode 

    According to this page, the header files for OpengGL should be in the Headers directory, but it doesn't exists.

    Pu5QsTe.png

    Here is also a screenshot of the error.

    9jtntWk.png

  11. #11
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: OpenGL Issue

    According to that same page:
    OpenGl is included <OpenGL/gl.h> rather than the more expected <gl/gl.h> on other platforms.
    and I think you will see an OpenGL folder in that framework... what's in it?

  12. #12
    Join Date
    Feb 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL Issue

    It's not a directory. It appears to be a binary file of some sort.

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

    Default Re: OpenGL Issue

    Quote Originally Posted by Wnt2bsleepin View Post
    It's not a directory. It appears to be a binary file of some sort.
    Your own screenshot claims it's an alias to something (probably some other bundle that contains those development files).
    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.


  14. #14
    Join Date
    Feb 2013
    Posts
    9
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: OpenGL Issue

    Quote Originally Posted by wysota View Post
    Your own screenshot claims it's an alias to something (probably some other bundle that contains those development files).
    Not familiar with that. Is there a way to find out where it goes?

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

    Default Re: OpenGL Issue

    My knowledge of MacOSX is very limited, I'm afraid I can't help you.
    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.


Similar Threads

  1. converting GLUT/OpenGL to Qt/OpenGL - displaying issue
    By yoti13 in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2012, 00:45
  2. 4.5.2 =>4.6.3 OpenGL shaders+qrphicsview issue
    By medved6 in forum Qt Programming
    Replies: 1
    Last Post: 22nd August 2010, 19:33
  3. Possible OpenGL / Intel driver issue
    By Truder in forum Qt Programming
    Replies: 0
    Last Post: 24th February 2009, 11:06
  4. Opengl issue with Qt4.4.3
    By j0rt4g4 in forum Newbie
    Replies: 13
    Last Post: 2nd December 2008, 12:36
  5. OpenGl Issue
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 7th April 2007, 05:28

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.