Ejemplo n.º 1
0
 def __init__(self, share_group, config, hdc, mode):
     print "GLContext: mode =", mode  ###
     GGLContext.__init__(self, share_group)
     shared_context = self._get_shared_context()
     if shared_context:
         share_ctx = shared_context._win_context
     else:
         share_ctx = None
     ipf, actpf = config._win_supported_pixelformat(hdc, mode)
     config._check_win_pixelformat(actpf, mode)
     print "GLContext: Setting pixel format", ipf, "for hdc", hdc  ###
     wgl.SetPixelFormat(hdc, ipf, actpf)
     print "GLContext: Creating context for hdc", hdc  ###
     ctx = wgl.wglCreateContext(hdc)
     if share_ctx:
         wgl.wglShareLists(share_ctx, ctx)
     self._win_context = ctx
     self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
 def __init__(self, share_group, config, hdc, mode):
     print "GLContext: mode =", mode ###
     GGLContext.__init__(self, share_group)
     shared_context = self._get_shared_context()
     if shared_context:
         share_ctx = shared_context._win_context
     else:
         share_ctx = None
     ipf, actpf = config._win_supported_pixelformat(hdc, mode)
     config._check_win_pixelformat(actpf, mode)
     print "GLContext: Setting pixel format", ipf, "for hdc", hdc ###
     wgl.SetPixelFormat(hdc, ipf, actpf)
     print "GLContext: Creating context for hdc", hdc ###
     ctx = wgl.wglCreateContext(hdc)
     if share_ctx:
         wgl.wglShareLists(share_ctx, ctx)
     self._win_context = ctx
     self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
Ejemplo n.º 3
0
 def __init__(self, share_group, config, hdc, mode):
     print("GLContext: mode =", mode)  ###
     GGLContext.__init__(self, share_group)
     shared_context = self._get_shared_context()
     if shared_context:
         share_ctx = shared_context._win_context
     else:
         share_ctx = None
     ipf, act_attrs = config._win_supported_pixelformat(hdc, mode)
     if ipf is None:
         raise GLConfigError
     #config._check_win_pixelattrs(act_attrs, mode)
     print("GLContext: Setting pixel format", ipf, "for hdc", hdc)  ###
     WGL.SetPixelFormat(hdc, ipfs)
     ctx = wgl.wglCreateContext(hdc)
     if share_ctx:
         wgl.wglShareLists(share_ctx, ctx)
     self._win_context = ctx
     self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
Ejemplo n.º 4
0
    def _get_cur_win_context(self, hdc):
        if threading.current_thread() in self._win_contexts:
            return self._win_contexts[threading.current_thread()]

        if hasattr(self, '_win_context'):
            shared_context = self._win_context
        else:
            shared_context = None
        ipf, actpf = self._config._win_supported_pixelformat(hdc, self._mode)
        self._config._check_win_pixelformat(actpf, self._mode)
        #print "GLContext: Setting pixel format", ipf, "for hdc", hdc ###
        wgl.SetPixelFormat(hdc, ipf, actpf)
        #print "GLContext: Creating context for hdc", hdc ###
        ctx = wgl.wglCreateContext(hdc)
        if shared_context:
            wgl.wglShareLists(shared_context, ctx)

        self._win_contexts[threading.current_thread()] = ctx
        return ctx