如何使用gl interop在Blender BGE(python3.3)中创建Context? 当我用这种方式时
from OpenGL import platform as gl_platform
ctx_props = cl.context_properties
props = []
if sys.platform == "linux":
from OpenGL import GLX
props.append((ctx_props.PLATFORM, self.platform))
props.append((ctx_props.GL_CONTEXT_KHR, GLX.glXGetCurrentContext()))
props.append((ctx_props.GLX_DISPLAY_KHR, GLX.glXGetCurrentDisplay()))
elif sys.platform == "win32":
from OpenGL import WGL
props.append((ctx_props.PLATFORM, self.platform))
props.append((ctx_props.GL_CONTEXT_KHR, gl_platform.GetCurrentContext()))
props.append((ctx_props.WGL_HDC_KHR, WGL.wglGetCurrentDC()))
elif sys.platform == "darwin":
props.append((ctx_props.CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, cl.get_apple_cgl_share_group()))
if sys.platform == "darwin":
ctx = cl.Context(properties=props, devices=[])
else:
try:
ctx = cl.Context(properties=props)
except:
ctx = cl.Context(properties=props, devices = [device])
Blender坠毁了。 我使用Blender 2.65& pyopencl形式git。 Ubuntu 12.10。