def __enter__(self): assert (self._count == 0) self.ctx = gtkgl.widget_get_gl_context(self._widget) self.surface = gtkgl.widget_get_gl_drawable(self._widget) self._begin = self.surface.gl_begin(self.ctx) if self._begin: self._count += 1 if self._projection is not None: glMatrixMode(GL_PROJECTION) glLoadMatrixd(self._projection) if self._modelview is not None: glMatrixMode(GL_MODELVIEW) glLoadMatrixd(self._modelview) return self return
def __enter__(self): assert(self._count == 0) self.ctx = gtkgl.widget_get_gl_context(self._widget) self.surface = gtkgl.widget_get_gl_drawable(self._widget) self._begin = self.surface.gl_begin(self.ctx) if self._begin: self._count += 1 if self._projection is not None: glMatrixMode(GL_PROJECTION) glLoadMatrixd(self._projection) if self._modelview is not None: glMatrixMode(GL_MODELVIEW) glLoadMatrixd(self._modelview) return self return
def __init__(self, widget): self.widget = widget self.gldrawable = gtkgl.widget_get_gl_drawable(widget) assert self.gldrawable, "failed to get the GL drawable for %s" % widget self.glcontext = gtkgl.widget_get_gl_context(widget) assert self.glcontext, "failed to get a GL context from %s" % widget
def get_gl_drawable(self): return gtkgl.widget_get_gl_drawable(self._backing)
def __exit__(self, exc_type, exc_val, exc_tb): gldrawable = gtkgl.widget_get_gl_drawable(self.widget) gldrawable.gl_end()
def __enter__(self): gldrawable = gtkgl.widget_get_gl_drawable(self.widget) glcontext = gtkgl.widget_get_gl_context(self.widget) assert gldrawable.gl_begin(glcontext)