def _get_egl_func(func_name, res_type, *arg_types): address = egl.eglGetProcAddress(func_name) if address is None: return None proto = ctypes.CFUNCTYPE(res_type) proto.argtypes = arg_types func = proto(address) return func
def define_egl_ext_function(func_name, res_type, *arg_types): if hasattr(egl, func_name): return # function already exists addr = egl.eglGetProcAddress(func_name) if addr is None: return # function is not available else: proto = ctypes.CFUNCTYPE(res_type) proto.argtypes = arg_types globals()['proto__' + func_name] = proto # avoid garbage collection func = proto(addr) setattr(egl, func_name, func)
def gl_get_proc(self, proc): """This function is used to get a pointer to an OpenGL extension function. This is only necessary on the Windows platform, because the OpenGL implementation shipped with Windows only supports OpenGL version 1.1. PROTOTYPE: void * VidExt_GL_GetProcAddress(const char* Proc)""" address = egl.eglGetProcAddress(proc) if address is not None: return address else: log.error(f"Vidext: gl_get_proc({proc.decode()}) returns None")
pass # pylint: disable=g-import-not-at-top from OpenGL import EGL from OpenGL import error from six.moves import range # From the EGL_EXT_device_enumeration extension. EGLDeviceEXT = ctypes.c_void_p PFNEGLQUERYDEVICESEXTPROC = ctypes.CFUNCTYPE(EGL.EGLBoolean, EGL.EGLint, ctypes.POINTER(EGLDeviceEXT), ctypes.POINTER(EGL.EGLint)) try: _eglQueryDevicesEXT = PFNEGLQUERYDEVICESEXTPROC( # pylint: disable=invalid-name EGL.eglGetProcAddress('eglQueryDevicesEXT')) except TypeError: raise ImportError('eglQueryDevicesEXT is not available.') # From the EGL_EXT_platform_device extension. EGL_PLATFORM_DEVICE_EXT = 0x313F PFNEGLGETPLATFORMDISPLAYEXTPROC = ctypes.CFUNCTYPE(EGL.EGLDisplay, EGL.EGLenum, ctypes.c_void_p, ctypes.POINTER(EGL.EGLint)) try: eglGetPlatformDisplayEXT = PFNEGLGETPLATFORMDISPLAYEXTPROC( # pylint: disable=invalid-name EGL.eglGetProcAddress('eglGetPlatformDisplayEXT')) except TypeError: raise ImportError('eglGetPlatformDisplayEXT is not available.')
def get_proc_address(self, s): return egl.eglGetProcAddress(s)