diff options
author | Michael Bien <[email protected]> | 2010-01-02 00:35:04 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-02 00:35:04 +0100 |
commit | 9575f39cc204dc31d85233ecf4b09443190c3673 (patch) | |
tree | 763a6c5a59a161f1e63f8adc4cadc74dbed473bc /src | |
parent | a5efe050242d1d6a45e03fcac1763ff90877e322 (diff) |
fixed shared context creation code.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/mbien/opencl/CLGLContext.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/mbien/opencl/CLGLContext.java b/src/com/mbien/opencl/CLGLContext.java index 9699c1ba..407c7311 100644 --- a/src/com/mbien/opencl/CLGLContext.java +++ b/src/com/mbien/opencl/CLGLContext.java @@ -26,7 +26,6 @@ public final class CLGLContext extends CLContext { public static CLGLContext create(GLContext glContext) { - long glID = glContext.getContext(); //UNIX //cl_context_properties props[] = { @@ -45,6 +44,8 @@ public final class CLGLContext extends CLContext { // CL_CGL_SHAREGROUP_KHR, (cl_context_properties)TODO 0, // CL_CONTEXT_PLATFORM, (cl_context_properties)cpPlatform, 0}; + long glID = 0; + GLContextImpl ctxImpl = (GLContextImpl)glContext; DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration)ctxImpl.getDrawableImpl() @@ -53,6 +54,7 @@ public final class CLGLContext extends CLContext { LongBuffer properties = LongBuffer.allocate(5); if(glContext instanceof X11GLXContext) { long handle = config.getScreen().getDevice().getHandle(); + glID = ((X11GLXContext)glContext).getContext(); properties.put(CLGLI.CL_GL_CONTEXT_KHR).put(glID) .put(CLGLI.CL_GLX_DISPLAY_KHR).put(handle); }else if(glContext instanceof WindowsWGLContext) { @@ -61,6 +63,8 @@ public final class CLGLContext extends CLContext { }else if(glContext instanceof MacOSXCGLContext) { // TODO test on mac throw new RuntimeException("cl-gl interoperability on mac not yet implemented"); + }else{ + throw new RuntimeException("unsupported GLContext: "+glContext); } properties.put(0).rewind(); // 0 terminated array |