如何使用 gl interop 在 Blender BGE (python3.3) 中创建上下文?当我用这种方式
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 2.65 & pyopencl form git。Ubuntu 12.10。