Created
March 24, 2011 15:12
-
-
Save enjalot/885214 to your computer and use it in GitHub Desktop.
PyOpenCL .92 GL Interop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from OpenGL import GLX | |
def clinit(self): | |
plats = cl.get_platforms() | |
ctx_props = cl.context_properties | |
props = [(ctx_props.PLATFORM, plats[0]), | |
(ctx_props.GL_CONTEXT_KHR, platform.GetCurrentContext())] | |
import sys | |
if sys.platform == "linux2": | |
props.append((ctx_props.GLX_DISPLAY_KHR, | |
GLX.glXGetCurrentDisplay())) | |
elif sys.platform == "win32": | |
props.append((ctx_props.WGL_HDC_KHR, | |
WGL.wglGetCurrentDC())) | |
self.ctx = cl.Context(properties=props) | |
self.queue = cl.CommandQueue(self.ctx) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment