diff options
author | Michael Bien <[email protected]> | 2010-03-16 22:55:32 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-03-16 22:55:32 +0100 |
commit | 36a289538cdb9373d8eb7700e616f019231ab591 (patch) | |
tree | 6310f16df3195b3d7553dde34ef52bca84270461 /src/com/mbien/opencl/gl/CLGLContext.java | |
parent | 919d8e9f992c07ab18ddd6d192d6747e8d7aa40b (diff) |
get(GL)Context() and getCL() getters.
fix in isGLMemorySharingSupported() on mac.
javadoc fixes.
Diffstat (limited to 'src/com/mbien/opencl/gl/CLGLContext.java')
-rw-r--r-- | src/com/mbien/opencl/gl/CLGLContext.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/com/mbien/opencl/gl/CLGLContext.java b/src/com/mbien/opencl/gl/CLGLContext.java index 3c6711f5..ec0f909f 100644 --- a/src/com/mbien/opencl/gl/CLGLContext.java +++ b/src/com/mbien/opencl/gl/CLGLContext.java @@ -22,10 +22,12 @@ import static com.mbien.opencl.gl.CLGLI.*; public final class CLGLContext extends CLContext { final long glID; + private final GLContext glContext; - private CLGLContext(CLPlatform platform, long clContextID, long glContextID) { + private CLGLContext(CLPlatform platform, GLContext glContext, long clContextID, long glContextID) { super(platform, clContextID); this.glID = glContextID; + this.glContext = glContext; } /** @@ -72,7 +74,7 @@ public final class CLGLContext extends CLContext { PointerBuffer properties = setupContextProperties(platform, glContext, glID); long clID = createContextFromType(properties, toDeviceBitmap(deviceTypes)); - return new CLGLContext(platform, clID, glID[0]); + return new CLGLContext(platform, glContext, clID, glID[0]); } @@ -90,7 +92,7 @@ public final class CLGLContext extends CLContext { PointerBuffer properties = setupContextProperties(platform, glContext, glID); long clID = createContext(properties, devices); - CLGLContext context = new CLGLContext(platform, clID, glID[0]); + CLGLContext context = new CLGLContext(platform, glContext, clID, glID[0]); if(devices != null) { for (int i = 0; i < devices.length; i++) { context.overrideContext(devices[i]); @@ -225,5 +227,24 @@ public final class CLGLContext extends CLContext { return buffer; } + /** + * Return the low level OpenCL interface with OpenGL interoperability. + */ + @Override + public CLGLI getCL() { + return (CLGLI)super.getCL(); + } + + /** + * Returns the OpenGL context this context was shared with. + */ + public GLContext getGLContext() { + return glContext; + } + + @Override + public CLGLContext getContext() { + return this; + } } |