[PyOpenGL-Users] glGenLists returns 0

Gary Herron gherron at islandtraining.com
Sat May 17 12:11:22 EDT 2008


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()
>
>   




More information about the Python-list mailing list