コード例 #1
0
ファイル: base.py プロジェクト: scotteifel/tasktrack
    def set_current(self):
        if not self.canvas:
            self.is_ok = 0
            raise RuntimeError('Canvas has not been attached')

        # XXX not per-thread
        gl.current_context = self

        # XXX
        gl_info.set_active_context()
        glu_info.set_active_context()

        # Implement workarounds
        if not self._info:
            self._info = gl_info.GLInfo()
            self._info.set_active_context()
            for attr, check in self._workaround_checks:
                setattr(self, attr, check(self._info))

        # Release textures and buffers on this context scheduled for deletion.
        # Note that the garbage collector may introduce a race condition,
        # so operate on a copy of the textures/buffers and remove the deleted
        # items using list slicing (which is an atomic operation)
        if self.object_space._doomed_textures:
            textures = self.object_space._doomed_textures[:]
            textures = (gl.GLuint * len(textures))(*textures)
            gl.glDeleteTextures(len(textures), textures)
            self.object_space._doomed_textures[0:len(textures)] = []
        if self.object_space._doomed_buffers:
            buffers = self.object_space._doomed_buffers[:]
            buffers = (gl.GLuint * len(buffers))(*buffers)
            gl.glDeleteBuffers(len(buffers), buffers)
            self.object_space._doomed_buffers[0:len(buffers)] = []
コード例 #2
0
    def set_current(self):
        if not self.canvas:
            raise RuntimeError('Canvas has not been attached')

        # XXX not per-thread
        gl.current_context = self

        # XXX
        gl_info.set_active_context()
        glu_info.set_active_context()

        # Implement workarounds
        if not self._info:
            self._info = gl_info.GLInfo()
            self._info.set_active_context()
            for attr, check in self._workaround_checks:
                setattr(self, attr, check(self._info))

        # Release textures and buffers on this context scheduled for deletion.
        # Note that the garbage collector may introduce a race condition,
        # so operate on a copy of the textures/buffers and remove the deleted
        # items using list slicing (which is an atomic operation)
        if self.object_space._doomed_textures:
            textures = self.object_space._doomed_textures[:]
            textures = (gl.GLuint * len(textures))(*textures)
            gl.glDeleteTextures(len(textures), textures)
            self.object_space._doomed_textures[0:len(textures)] = []
        if self.object_space._doomed_buffers:
            buffers = self.object_space._doomed_buffers[:]
            buffers = (gl.GLuint * len(buffers))(*buffers)
            gl.glDeleteBuffers(len(buffers), buffers)
            self.object_space._doomed_buffers[0:len(buffers)] = []
コード例 #3
0
    def set_current(self):
        if not self.canvas:
            raise RuntimeError('Canvas has not been attached')
        # XXX not per-thread
        gl.current_context = self

        # XXX
        gl_info.set_active_context()
        glu_info.set_active_context()

        # Implement workarounds
        if not self._info:
            self._info = gl_info.GLInfo()
            self._info.set_active_context()
            for attr, check in self._workaround_checks:
                setattr(self, attr, check(self._info))

        # Release textures on this context scheduled for deletion
        if self.object_space._doomed_textures:
            textures = self.object_space._doomed_textures
            textures = (gl.GLuint * len(textures))(*textures)
            gl.glDeleteTextures(len(textures), textures)
            self.object_space._doomed_textures = []

        # Release buffers on this context scheduled for deletion
        if self.object_space._doomed_buffers:
            buffers = self.object_space._doomed_buffers
            buffers = (gl.GLuint * len(buffers))(*buffers)
            gl.glDeleteBuffers(len(buffers), buffers)
            self.object_space._doomed_buffers = []
コード例 #4
0
ファイル: base.py プロジェクト: sabotage3d/kv6view
    def set_current(self):
        if not self.canvas:
            raise RuntimeError('Canvas has not been attached')
        # XXX not per-thread
        gl.current_context = self

        # XXX
        gl_info.set_active_context()
        glu_info.set_active_context()

        # Implement workarounds
        if not self._info:
            self._info = gl_info.GLInfo()
            self._info.set_active_context()
            for attr, check in self._workaround_checks:
                setattr(self, attr, check(self._info))

        # Release textures on this context scheduled for deletion
        if self.object_space._doomed_textures:
            textures = self.object_space._doomed_textures
            textures = (gl.GLuint * len(textures))(*textures)
            gl.glDeleteTextures(len(textures), textures)
            self.object_space._doomed_textures = []

        # Release buffers on this context scheduled for deletion
        if self.object_space._doomed_buffers:
            buffers = self.object_space._doomed_buffers
            buffers = (gl.GLuint * len(buffers))(*buffers)
            gl.glDeleteBuffers(len(buffers), buffers)
            self.object_space._doomed_buffers = []
コード例 #5
0
ファイル: GtkGlDrawingArea.py プロジェクト: HuFlungDu/GSEF
 def switch_to(self):
     if sys.platform == 'darwin':
         agl.aglSetCurrentContext(self._agl_context)
         _aglcheck()
     elif sys.platform in ('win32', 'cygwin'):
         self._dc = _user32.GetDC(self.window.handle)
         self.context._set_window(self)
         wgl.wglMakeCurrent(self._dc, self.context.glx_context)
     else:
         glx.glXMakeCurrent(self.context.x_display, self.get_property('window').get_xid(),self.context.glx_context)
     self.context.set_current()
     gl_info.set_active_context()
     glu_info.set_active_context()
コード例 #6
0
ファイル: __init__.py プロジェクト: KevinGoodsell/sympy
    def switch_to(self):
        if self._glx_1_3:
            if not self._glx_window:
                self._glx_window = glx.glXCreateWindow(self._x_display,
                    self._config._fbconfig, self._window, None)
            glx.glXMakeContextCurrent(self._x_display,
                self._glx_window, self._glx_window, self._glx_context)
        else:
            glx.glXMakeCurrent(self._x_display, self._window, self._glx_context)

        self.set_vsync(self._vsync)

        self._context.set_current()
        gl_info.set_active_context()
        glu_info.set_active_context()
コード例 #7
0
    def switch_to(self):
        if self._glx_1_3:
            if not self._glx_window:
                self._glx_window = glx.glXCreateWindow(self._x_display,
                                                       self._config._fbconfig,
                                                       self._window, None)
            glx.glXMakeContextCurrent(self._x_display, self._glx_window,
                                      self._glx_window, self._glx_context)
        else:
            glx.glXMakeCurrent(self._x_display, self._window,
                               self._glx_context)

        self.set_vsync(self._vsync)

        self._context.set_current()
        gl_info.set_active_context()
        glu_info.set_active_context()
コード例 #8
0
 def switch_to(self):
     agl.aglSetCurrentContext(self._agl_context)
     self._context.set_current()
     _aglcheck()
     gl_info.set_active_context()
     glu_info.set_active_context()
コード例 #9
0
 def switch_to(self):
     wgl.wglMakeCurrent(self._dc, self._wgl_context)
     self._context.set_current()
     gl_info.set_active_context()
     glu_info.set_active_context()