pyopenGL: glutInit : TypeError: not a list

Rakesh rakesh_usenet at yahoo.com
Tue Mar 29 22:31:21 CEST 2005


After some playing around, here is how my code looks like and it works:


from OpenGL.GL import *
from OpenGL.GLUT import *
import sys

def init():
   glClearColor(0, 0, 0, 0)
   glMatrixMode(GL_PROJECTION)
   glLoadIdentity()
   glLightfv(GL_LIGHT0, GL_AMBIENT,
   [0.0, 0.0, 0.0, 1.0])
   glLightfv(GL_LIGHT0, GL_DIFFUSE,
   [1.0, 1.0, 1.0, 1.0])
   glLightfv(GL_LIGHT0, GL_POSITION,
   [0.0, 3.0, 3.0, 0.0])
   glLightModelfv(GL_LIGHT_MODEL_AMBIENT,
   [0.2, 0.2, 0.2, 1.0])
   glEnable(GL_LIGHTING)
   glEnable(GL_LIGHT0)

def display():
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
   glMaterialfv(GL_FRONT, GL_AMBIENT,
   [0.1745, 0.0, 0.1, 0.0])
   glMaterialfv(GL_FRONT, GL_DIFFUSE,
   [0.1, 0.0, 0.6, 0.0])
   glMaterialfv(GL_FRONT, GL_SPECULAR,
   [0.7, 0.6, 0.8, 0.0])
   glMaterialf(GL_FRONT, GL_SHININESS, 80)
   glutSolidTeapot(0.5)
   glFlush()

glutInit(sys.argv)
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(250, 250)
glutCreateWindow('Hello GLUT')
glutDisplayFunc(display)
init()
glutMainLoop()




More information about the Python-list mailing list