Advertisement Jump to content
Sign in to follow this  

GLUT Trouble

This topic is 3948 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I am trying to get PyOpenGL to work and am having an incredibly difficult time getting GLUT to work. I have simplified my tests from an extremely simple program down to an even simpler program, this:
from OpenGL.GL import *
from OpenGL.GLUT import *

def init():
    glClearColor(0, 0, 0, 0)

def display():

OpenGL.GLUT.glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
and I get this error:
Traceback (most recent call last):
  File "C:/Python25/Py3D/", line 11, in <module>
    OpenGL.GLUT.glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
  File "C:\Python25\Lib\site-packages\OpenGL\platform\", line 258, in __call__
    self.__name__, self.__name__,
NullFunctionError: Attempt to call an undefined function glutInitDisplayMode, check for bool(glutInitDisplayMode) before calling
unless I omit the last line of code from the program. I assume that this means that GLUT is not working, despite the fact that I have it installed and it works on Microsoft Visual C++ 2008. What gives?

Share this post

Link to post
Share on other sites
Have you tried saying:

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)

since you're using "from ... import *" instead of "import ..."

Share this post

Link to post
Share on other sites
Yes -- the only reason I was using "OpenGL.GLUT.glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)" was because "glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)" was not working and I wanted to make sure that the import was not what was causing the issue (since OpenGL seemed to be imported correctly). For some reason, it seems that the actual glut functions are not being found by python. I know that I have them, as I can use OpenGL with Microsoft Visual C++, but apparently not with python. Is there something special I have to do, like moving .lib files around? I already tried the obvious, like pasting glut32.lib in the python libs folder, and it didn't seem to work. Does anyone here actually know what needs to be done to get GLUT up on python?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!