From 3927b655a960913f672a39dd7a445d326bf93158 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 28 Jan 2016 09:37:23 -0700 Subject: [PATCH] Fix GL interop (reported by Kevin Jones) --- pyopencl/cffi_cl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index 31ae7f5f..181699e4 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -625,7 +625,13 @@ def _parse_context_properties(properties): 'CGL_SHAREGROUP_KHR', )]: - val = int(_ffi.cast('intptr_t', value)) + import ctypes + if isinstance(value, ctypes._Pointer): + import struct + val, = struct.unpack("P", bytes(memoryview(value))) + else: + val = int(value) + if not val: raise LogicError("You most likely have not initialized " "OpenGL properly.", -- GitLab