471,073 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

Re: [PyOpenGL-Users] glGenLists returns 0

Astan Chee wrote:
Hi,
Im trying to do glGenLists while a program is running and it keeps
returning 0 and whenever I try to do a glCallList, it fails with a
'invalid value' error.
Is this a known issue? why would my program give valid glGenList while
being initialized but not while it is running?
IIRC, this can happen if you call glGenLists *before* you create any
windows (or perhaps more accurately, before an OpenGL context has been
created).
Im using wx to create a new pygame thread that uses pyopengl. This is
the glGenList snippet:

dlBody = glGenLists(1)
glNewList(dlBody,GL_COMPILE)
SphereT = gluNewQuadric()
gluSphere(SphereT, 0.5, 32, 32)
gluQuadricNormals(SphereT, GLU_SMOOTH)
gluQuadricDrawStyle(SphereT, GLU_FILL)
glEndList()

and here is how I init:

glShadeModel(GL_SMOOTH)
glClearColor(0.0, 0.0, 0.0, 0.0)
glClearDepth(1.0)
glEnable(GL_DEPTH_TEST)
glDepthFunc(GL_LEQUAL)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)

glEnable (GL_LIGHT0)
glEnable (GL_LIGHTING)
glEnable(GL_TEXTURE_2D)

LightAmbient = ( (0., 0., 0., 0.,1.) )
glLightModelfv( GL_LIGHT_MODEL_AMBIENT, LightAmbient )

glEnable(GL_COLOR_MATERIAL)

glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(45, 1.0*width/height, 1.0, 10000.0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()

Jun 27 '08 #1
0 836

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.