'Initialize OpenGL for use in the window.'

def OnInitGL(self, call_reshape=True):

    if self.GLinitialized:
        return
    self.GLinitialized = True
    self.pygletcontext = gl.Context(gl.current_context)
    self.pygletcontext.canvas = self
    self.pygletcontext.set_current()
    glClearColor(*self.color_background)
    glClearDepth(1.0)
    glDepthFunc(GL_LEQUAL)
    glEnable(GL_COLOR_MATERIAL)
    glEnable(GL_DEPTH_TEST)
    glEnable(GL_CULL_FACE)
    glEnable(GL_BLEND)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
    if call_reshape:
        self.OnReshape()
