PyOpenGL glClearColor() trouble

TheDustbustr thedustbustr at aol.com
Sat Apr 19 21:51:50 EDT 2003


from OpenGL.GL import *
import OpenGL.Tk as Tk

class Test:
    def __init__(self):
        self.ogl=Tk.Opengl(width=800,height=600,double=1)
        self.ogl.pack(side='top', expand=1, fill='both')
        self.ogl.redraw=self.draw

        self.setup()
        self.ogl.mainloop()

    def setup(self):
        """Why does the following line not work..."""
        glClearColor(0, 0, 0, 0)

    def draw(self, tkev=None):
        """but uncommenting this line and commenting the previous one DOES
work!?"""
        #glClearColor(0, 0, 0, 0)
        glClear(GL_COLOR_BUFFER_BIT)

Test()

The way the script is set up right now (second glClearColor commented), glClear
clears the screen to the default ClearColor (1,0,1,0 aka pink).  I can only
make the ClearColor black (0,0,0,0) when I call glClearColor in the ogl.redraw
function... This is inconvienent and I shouldn't need to be called every frame.




More information about the Python-list mailing list