R
Rakesh
Hi,
I am starting to write this sample program in Python to use the GLUT
library.
<-->
from OpenGL.GL import *
from OpenGL.GLUT import *
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(' ')
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(250, 250)
glutCreateWindow('Hello GLUT')
glutSetDisplayFuncCallback(display)
glutDisplayFunc()
init()
glutMainLoop()
<-->
This program is just supposed to display a teapot .
When I run it I get the following error.
C:\>python usenetviz.py
Traceback (most recent call last):
File "usenetviz.py", line 31, in ?
glutInit(' ')
TypeError: not a list
I run MS Windows (XP - SP 2)
I run Python 2.4
and the latest version of PyOpenGL compatible with the same.
Please let me know what needs to be done in this regard to fix the
above error.
I searched the archives of this newsgroup before posting this one. And
I could not get the fix to the same.
Thanks for helping.
I am starting to write this sample program in Python to use the GLUT
library.
<-->
from OpenGL.GL import *
from OpenGL.GLUT import *
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(' ')
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
glutInitWindowSize(250, 250)
glutCreateWindow('Hello GLUT')
glutSetDisplayFuncCallback(display)
glutDisplayFunc()
init()
glutMainLoop()
<-->
This program is just supposed to display a teapot .
When I run it I get the following error.
C:\>python usenetviz.py
Traceback (most recent call last):
File "usenetviz.py", line 31, in ?
glutInit(' ')
TypeError: not a list
I run MS Windows (XP - SP 2)
I run Python 2.4
and the latest version of PyOpenGL compatible with the same.
Please let me know what needs to be done in this regard to fix the
above error.
I searched the archives of this newsgroup before posting this one. And
I could not get the fix to the same.
Thanks for helping.