diff options
Diffstat (limited to 'src/com/mbien/opencl/CLGLBuffer.java')
-rw-r--r-- | src/com/mbien/opencl/CLGLBuffer.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/com/mbien/opencl/CLGLBuffer.java b/src/com/mbien/opencl/CLGLBuffer.java index 566f45ec..40298ad7 100644 --- a/src/com/mbien/opencl/CLGLBuffer.java +++ b/src/com/mbien/opencl/CLGLBuffer.java @@ -11,12 +11,18 @@ import static com.mbien.opencl.CLGLI.*; */ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> { - private CLGLBuffer(CLContext context, B directBuffer, long id) { + /** + * 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 glBuffer) { + static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, int flags, int glObject) { if(directBuffer != null && !directBuffer.isDirect()) throw new IllegalArgumentException("buffer is not a direct buffer"); @@ -29,14 +35,14 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> { int[] result = new int[1]; CLGLI clgli = (CLGLI)cl; - long id = clgli.clCreateFromGLBuffer(context.ID, flags, glBuffer, result, 0); + long id = clgli.clCreateFromGLBuffer(context.ID, flags, glObject, result, 0); - return new CLGLBuffer<B>(context, directBuffer, id); + return new CLGLBuffer<B>(context, directBuffer, id, glObject); } @Override public <T extends Buffer> CLGLBuffer<T> cloneWith(T directBuffer) { - return new CLGLBuffer<T>(context, directBuffer, ID); + return new CLGLBuffer<T>(context, directBuffer, ID, GLID); } /** @@ -59,6 +65,11 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> { return array[0]; } + @Override + public String toString() { + return "CLMemory [id: " + ID+" glID: "+GLID+"]"; + } + public enum GLObjectType { GL_OBJECT_BUFFER(CL_GL_OBJECT_BUFFER), |