I am trying to learn the basics of game programming and I have installed pygame
and pyopengl
for that.
MyCode:
import sys
import OpenGL
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
def draw():
glClear(GL_COLOR_BUFFER_BIT)
glutWireTeapot(0.5)
glFlush()
glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(250, 250)
glutInitWindowPosition(100, 100)
glutCreateWindow("Python OGL Program")
glutDisplayFunc(draw)
glutMainLoop()
draw()
When I run the above code in my command prompt using
python test.py
I get the following error.
Traceback (most recent call last):
File "test.py", line 13, in <module>
glutInit(sys.argv)
File "C:\Python27\lib\site-packages\pyopengl-3.0.2a5-py2.7.egg\OpenGL\GLUT\special.py", line 324, in glutInit
_base_glutInit( ctypes.byref(count), holder )
TypeError: 'NoneType' object is not callable
I don't understand why I am getting this error. Am I calling glutinit
in a wrong way?
I am using Python 2.7.2.
I was using Python 2.7.3 on Windows 7 64-bit and had a problem causing the same symptoms as Noob.
But the above PyOpenGL reinstallation solution did not help me.
I try a longshot - installation of freeglut - and it helped!
I used Windows MSVC 2.8.0 binary package from here and dropped both 32-bit and 64-bit DLLs to my 32-bit (c:\Windows\SysWOW64) and 64-bit (C:\Windows\System32) dirs accordingly.