def attach(self, canvas): share = self.context_share if share: if not share.canvas: raise RuntimeError('Share context has no canvas.') share = share._context attribs = [] if self.config.major_version is not None: attribs.extend([wglext_arb.WGL_CONTEXT_MAJOR_VERSION_ARB, self.config.major_version]) if self.config.minor_version is not None: attribs.extend([wglext_arb.WGL_CONTEXT_MINOR_VERSION_ARB, self.config.minor_version]) flags = 0 if self.config.forward_compatible: flags |= wglext_arb.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB if self.config.debug: flags |= wglext_arb.WGL_DEBUG_BIT_ARB if flags: attribs.extend([wglext_arb.WGL_CONTEXT_FLAGS_ARB, flags]) attribs.append(0) attribs = (c_int * len(attribs))(*attribs) self.config._set_pixel_format(canvas) self._context = wglext_arb.wglCreateContextAttribsARB(canvas.hdc, share, attribs) super(Win32ARBContext, self).attach(canvas)
def attach(self, canvas): share = self.context_share if share: if not share.canvas: raise RuntimeError('Share context has no canvas.') share = share._context attribs = [] if self.config.major_version is not None: attribs.extend([ wglext_arb.WGL_CONTEXT_MAJOR_VERSION_ARB, self.config.major_version ]) if self.config.minor_version is not None: attribs.extend([ wglext_arb.WGL_CONTEXT_MINOR_VERSION_ARB, self.config.minor_version ]) flags = 0 if self.config.forward_compatible: flags |= wglext_arb.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB if self.config.debug: flags |= wglext_arb.WGL_DEBUG_BIT_ARB if flags: attribs.extend([wglext_arb.WGL_CONTEXT_FLAGS_ARB, flags]) attribs.append(0) attribs = (c_int * len(attribs))(*attribs) self.config._set_pixel_format(canvas) self._context = wglext_arb.wglCreateContextAttribsARB( canvas.hdc, share, attribs) super(Win32ARBContext, self).attach(canvas)