Ejemplo n.º 1
0
Archivo: carbon.py Proyecto: arokem/Fos
    def attach(self, canvas):
        if self.config._requires_gl_3():
            raise ContextException('AGL does not support OpenGL 3')

        super(CarbonContext, self).attach(canvas)
        if isinstance(canvas, CarbonFullScreenCanvas):
            # XXX not used any more (cannot use AGL_BUFFER_RECT)   
            agl.aglEnable(self._context, agl.AGL_FS_CAPTURE_SINGLE)
            agl.aglSetFullScreen(self._context, canvas.width, canvas.height,
                                 canvas.screen._refresh_rate, 0)
        else:
            agl.aglSetDrawable(self._context, 
                               cast(canvas.drawable, agl.AGLDrawable))
        agl.aglSetCurrentContext(self._context)
        if canvas.bounds is not None:
            bounds = (gl.GLint * 4)(*canvas.bounds)
            agl.aglSetInteger(self._context, agl.AGL_BUFFER_RECT, bounds)
            agl.aglEnable(self._context, agl.AGL_BUFFER_RECT)
        else:
            agl.aglDisable(self._context, agl.AGL_BUFFER_RECT)
        _aglcheck()

        self.set_current()
Ejemplo n.º 2
0
    def attach(self, canvas):
        if self.config._requires_gl_3():
            raise ContextException('AGL does not support OpenGL 3')

        super(CarbonContext, self).attach(canvas)
        if isinstance(canvas, CarbonFullScreenCanvas):
            # XXX not used any more (cannot use AGL_BUFFER_RECT)
            agl.aglEnable(self._context, agl.AGL_FS_CAPTURE_SINGLE)
            agl.aglSetFullScreen(self._context, canvas.width, canvas.height,
                                 canvas.screen._refresh_rate, 0)
        else:
            agl.aglSetDrawable(self._context,
                               cast(canvas.drawable, agl.AGLDrawable))
        agl.aglSetCurrentContext(self._context)
        if canvas.bounds is not None:
            bounds = (gl.GLint * 4)(*canvas.bounds)
            agl.aglSetInteger(self._context, agl.AGL_BUFFER_RECT, bounds)
            agl.aglEnable(self._context, agl.AGL_BUFFER_RECT)
        else:
            agl.aglDisable(self._context, agl.AGL_BUFFER_RECT)
        _aglcheck()

        self.set_current()
Ejemplo n.º 3
0
Archivo: carbon.py Proyecto: arokem/Fos
 def detach(self):
     super(CarbonContext, self).detach()
     agl.aglSetDrawable(self._context, None)
     _aglcheck()
Ejemplo n.º 4
0
 def detach(self):
     super(CarbonContext, self).detach()
     agl.aglSetDrawable(self._context, None)
     _aglcheck()