Thread: [PyOpenGL-Users] Undefined glutInit
Brought to you by:
mcfletch
From: Andrew G. <ape...@gm...> - 2019-05-09 18:36:11
|
I’m getting this error: "OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling” I’m using MacOS 10.13.6 High Sierra, and I’m getting the error when trying to use PyOpenGL 3.1.0. I get the error whether using Python 2.7.16 or 3.7.3. I installed pyopengl with the command `pip install pyOpenGL` and I installed glut with the command `brew install freeglut`. I’m guessing that there is a library loading issue. So, I’ll describe where the glut binaries are located. When freeglut gets installed, it puts a symlink into `/usr/local/lib/libglut.dylib` which points to where homebrew installed freeglut in `/usr/local/Cellar/freeglut/3.0.0/lib`. When I just try searching Google for the error I’m getting, I have only found Windows users discussing it. The answers were typically to suggest using a precompiled wheel (that includes glut binaries) rather than installing it from pip, or maybe copying the glut.dll file into the same directory that the python program is running. I’ve tried to copy libglut.dylib into the same directory, and I still got the same error. I tried using pudb to walk through the code and see if I could find anything obvious. The line it seems to fail on is `glutInit special.py`. I’m unfamiliar with the code, so I don’t know how to debug further. Please help! Thanks, Andrew |
From: Ian M. <ia...@ge...> - 2019-05-10 15:01:23
|
Hi, It is unclear to me whether this is your code or someone else's, and I am not personally familiar with OSX. The usual culprit for `NullFunctionError`s is the lack of an OpenGL context, but I don't think `glutInit(...)` is one of the ones that requires (or indeed can succeed) the creation of one. I confirm your assessment of other programmers: there was some kind of bug with pip installs a while back. Given the simplicity of the problem, I'd expect some kind of setup issue, although I certainly don't know how to resolve it. Anyway, if this is your code, I would suggest not using GLUT, or at-least trying to reverse-engineer from a working sample. GLUT is ancient and bad—although in-fairness (and to my distress) people regularly still do use GLUT, in the face of better alternatives. If this is not your code, then it's worth a bug report to whichever project it is. Ian |
From: Ian M. <ia...@ge...> - 2019-05-10 15:29:57
|
On Fri, May 10, 2019 at 9:18 AM Andrew Grace <ape...@gm...> wrote: > I wanted to use pyOpenGL to learn about OpenGL (rather than having to use > C or C++). What would you recommend instead of GLUT? GLFW? > > There does seem to be a broken build, at least for MacOS. For example, > trying to pip install pyOpenGL-accelerate (on MacOS High Sierra) currently > fails and throws a stack trace. > > Thanks, > Andrew > |
From: Chris B. - N. F. <chr...@no...> - 2019-05-10 15:48:20
|
On May 10, 2019, at 8:29 AM, Ian Mallett <ia...@ge...> wrote: On Fri, May 10, 2019 at 9:18 AM Andrew Grace <ape...@gm...> wrote: > I wanted to use pyOpenGL to learn about OpenGL (rather than having to use > C or C++). What would you recommend instead of GLUT? GLFW? > Is embedding OpenGL in tkInter easy enough these days? (Or wx or qt). We’re using it with wx, though as part of a substantial app — not sure how easy it is to whip out a single window these days. trying to pip install pyOpenGL-accelerate (on MacOS High Sierra) currently > fails and throws a stack trace. > You might try conda/conda-forge. I think those builds are solid. -CHB |
From: Ian M. <ia...@ge...> - 2019-05-10 15:30:09
|
On Fri, May 10, 2019 at 9:18 AM Andrew Grace <ape...@gm...> wrote: > I wanted to use pyOpenGL to learn about OpenGL (rather than having to use > C or C++). This is how I got my start in graphics, FWIW. What would you recommend instead of GLUT? GLFW? > GLFW is definitely my recommendation for experimenting in C++. It's probably good in Python as-well, but I haven't used it, since I don't do a lot of graphics development in that language anymore. That said, in Python, I have used (and still use for the occasional one-off) pygame <https://www.pygame.org/news>, which supports graphics/OpenGL specifically on OSX. There's an active support community for it too. Really anything would be better than GLUT, though. |
From: Andrew G. <ape...@gm...> - 2019-05-10 15:55:09
|
By the way, I meant this as a bug report. Even if GLUT is not so good to use, it would still be good to fix this bug since a bunch of demo scripts won’t work. Is this mailing list the right place to report a bug? Or should I create an issue on github (https://github.com/mcfletch/pyopengl <https://github.com/mcfletch/pyopengl>)? Thanks, Andrew > On May 9, 2019, at 2:36 PM, Andrew Grace <ape...@gm...> wrote: > > I’m getting this error: > > "OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling” > > I’m using MacOS 10.13.6 High Sierra, and I’m getting the error when trying to use PyOpenGL 3.1.0. I get the error whether using Python 2.7.16 or 3.7.3. > > I installed pyopengl with the command `pip install pyOpenGL` and I installed glut with the command `brew install freeglut`. > > I’m guessing that there is a library loading issue. So, I’ll describe where the glut binaries are located. > > When freeglut gets installed, it puts a symlink into `/usr/local/lib/libglut.dylib` which points to where homebrew installed freeglut in `/usr/local/Cellar/freeglut/3.0.0/lib`. > > When I just try searching Google for the error I’m getting, I have only found Windows users discussing it. The answers were typically to suggest using a precompiled wheel (that includes glut binaries) rather than installing it from pip, or maybe copying the glut.dll file into the same directory that the python program is running. I’ve tried to copy libglut.dylib into the same directory, and I still got the same error. > > I tried using pudb to walk through the code and see if I could find anything obvious. The line it seems to fail on is `glutInit special.py`. I’m unfamiliar with the code, so I don’t know how to debug further. > > Please help! > > Thanks, > Andrew |