Version: Python 2.7.6 on Ubuntu 14.04
>>> import OpenGL
>>> import OpenGL.GLUT
>>> import OpenGL.GLUT.freeglut
>>> OpenGL.GLUT.freeglut.glutSetOption(OpenGL.GLUT.GLUT_ACTION_ON_WINDOW_CLOSE, OpenGL.GLUT.GLUT_ACTION_GLUTMAINLOOP_RETURNS)
Running the above in the Python REPL prints freeglut
to stderr and exits the Python REPL automatically. Why is this happening, and how can I fix this?
You have to call glutInit(sys.argv)
before any other GLUT function. glutInit
returns the parameter list with the GLUT specific parameters removed, which you can then use instead of sys.argv
or you replace it with this, i.e. sys.argv = glutInit(sys.argv)