def gl_context(self): b = self._backing if not b: log("cannot get an OpenGL context: no backing defined") return None if not is_realized(b): log.error("Error: OpenGL backing %s is not realized", b) return None w, h = self.size if w<=0 or h<=0: log.error("Error: invalid OpenGL backing size: %ix%i", w, h) return None try: context = GtkGLExtContext(b) except Exception as e: log("gl_context()", exc_info=True) log.error("Error: %s", e) return None log("%s.gl_context() GL Pixmap backing size: %d x %d, context=%s", self, w, h, context) return context
def check_GL_support(widget, force_enable=False): from xpra.client.gl.gtk_base.gtk_compat import GtkGLExtContext with GtkGLExtContext(widget): return check_PyOpenGL_support(force_enable)