diff options
author | Michael Bien <[email protected]> | 2010-03-08 17:08:03 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-03-08 17:08:03 +0100 |
commit | e081f13ca50353a7a9c34438a2f81d38e03e88a7 (patch) | |
tree | 7948e78a8e73fb4de5340a80075d35a8a1499c1f /src/com/mbien/opencl/CLGLBuffer.java | |
parent | 5ad19147a76f80635dcae18693929edbf1da2cbf (diff) |
introduced gl package and moved all interoperability functionality into it.
Diffstat (limited to 'src/com/mbien/opencl/CLGLBuffer.java')
-rw-r--r-- | src/com/mbien/opencl/CLGLBuffer.java | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/com/mbien/opencl/CLGLBuffer.java b/src/com/mbien/opencl/CLGLBuffer.java deleted file mode 100644 index 8b4e5f56..00000000 --- a/src/com/mbien/opencl/CLGLBuffer.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.mbien.opencl; - -import com.mbien.opencl.CLMemory.GLObjectType; -import java.nio.Buffer; - - -/** - * Shared buffer between OpenGL and OpenCL contexts. - * @author Michael Bien - */ -public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements CLGLObject { - - - /** - * The OpenGL object handle. - */ - public final int GLID; - - private CLGLBuffer(CLContext context, B directBuffer, long id, int glObject) { - super(context, directBuffer, id); - this.GLID = glObject; - } - - - static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, int flags, int glObject) { - checkBuffer(directBuffer, flags); - - CL cl = context.cl; - int[] result = new int[1]; - CLGLI clgli = (CLGLI)cl; - - long id = clgli.clCreateFromGLBuffer(context.ID, flags, glObject, result, 0); - - return new CLGLBuffer<B>(context, directBuffer, id, glObject); - } - - static <B extends Buffer> void checkBuffer(B directBuffer, int flags) throws IllegalArgumentException { - if (directBuffer != null && !directBuffer.isDirect()) { - throw new IllegalArgumentException("buffer is not a direct buffer"); - } - if (isHostPointerFlag(flags)) { - throw new IllegalArgumentException("CL_MEM_COPY_HOST_PTR or CL_MEM_USE_HOST_PTR can not be used with OpenGL Buffers."); - } - } - - public int getGLObjectID() { - return GLID; - } - - public GLObjectType getGLObjectType() { - return GLObjectType.GL_OBJECT_BUFFER; - } - - @Override - public <T extends Buffer> CLGLBuffer<T> cloneWith(T directBuffer) { - return new CLGLBuffer<T>(context, directBuffer, ID, GLID); - } - - @Override - public String toString() { - return "CLGLBuffer [id: " + ID+" glID: "+GLID+"]"; - } - -} |