PyGame + PyOpenGl + ZBuffer?

Max lu_gio at hotmail.com
Tue Sep 24 02:57:16 EDT 2002


I've inserted the set_attribute, then verify it was set.

    pygame.display.gl_set_attribute(GL_DEPTH_SIZE, 16)
    pygame.display.set_mode((640,480), OPENGL|DOUBLEBUF )
    print "ZBUFFER:",pygame.display.gl_get_attribute(GL_DEPTH_SIZE)
    print pygame.display.get_driver()

The display.get_driver() displays "directx"... DIRECTX????!!!!! WHY??? Is it
normal?

Inside the draw loop, I test if the depth test is still working...
        print "Enabled: ",glIsEnabled(GL_DEPTH_TEST)

It's a simple scene with four GL_QUADS overlapping; two with z=0 and two with
z=0.5
        glTranslate(100,100,0.5)
        glTranslate(100,100,0.0)

with a depth range from 0 to 1
    glDepthRange(0.0,1.0)

BUT... the zbuffer isn't still working... also I get a very low framerate.

HELLLP!!



Pete Shinners wrote:

> Max wrote:
> > I found my code is not working well in all computers: with a SiS 300/200
> > graphic card, the Z buffer seems disabled.
> >
> > The OpenGL initialization code is:
> >
> > pygame.init()
> > pygame.display.set_mode((640,480), OPENGL|DOUBLEBUF|HWSURFACE,32 )
> > glEnable(GL_DEPTH_TEST)
> > glDepthFunc(GL_LESS)
> > glDepthRange(0,1)
> >
> > How can I force Opengl to utilize ZBuffer?
>
> pygame has a function to control extra setting for opengl. it must be
> called before display.set_mode(). you'd probably want to pass something
> like "pygame.display.gl_set_attribute(GL_DEPTH_SIZE, 16)". perhaps try
> different sized depths?
>
> http://pygame.org/docs/ref/pygame_display.html#gl_set_attribute
>
> you might also try testing with GLUT, which usually builds with pyopengl.




More information about the Python-list mailing list