aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/gl/CLGLContext.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-04-26 15:49:23 +0200
committerMichael Bien <[email protected]>2011-04-26 15:49:23 +0200
commit5e3020e831a4b5fc04843db88642097b2ad072a9 (patch)
tree1c6357638275d104b5cd4b8648f621e06d182a1f /src/com/jogamp/opencl/gl/CLGLContext.java
parentc00dc66867518f32d6a2615aa8da71a52489d5d8 (diff)
- CLGLBuffer size must now be specified when the buffer is created
- but can be updated later if required (gl lock is mandatory) - added VBO CLGL test - javadoc updates
Diffstat (limited to 'src/com/jogamp/opencl/gl/CLGLContext.java')
-rw-r--r--src/com/jogamp/opencl/gl/CLGLContext.java42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/com/jogamp/opencl/gl/CLGLContext.java b/src/com/jogamp/opencl/gl/CLGLContext.java
index f8ca70af..6482f041 100644
--- a/src/com/jogamp/opencl/gl/CLGLContext.java
+++ b/src/com/jogamp/opencl/gl/CLGLContext.java
@@ -201,20 +201,46 @@ public final class CLGLContext extends CLContext {
}
// Buffers
- public final CLGLBuffer<?> createFromGLBuffer(int glBuffer, Mem... flags) {
- return createFromGLBuffer(null, glBuffer, Mem.flagsToInt(flags));
+ /**
+ * Creates a CLGLBuffer for memory sharing with the specified OpenGL buffer.
+ * @param glBuffer The OpenGL buffer handle like a vertex buffer or pixel buffer object.
+ * @param glBufferSize The size of the OpenGL buffer in bytes
+ * @param flags optional flags.
+ */
+ public final CLGLBuffer<?> createFromGLBuffer(int glBuffer, long glBufferSize, Mem... flags) {
+ return createFromGLBuffer(null, glBuffer, glBufferSize, Mem.flagsToInt(flags));
}
- public final CLGLBuffer<?> createFromGLBuffer(int glBuffer, int flags) {
- return createFromGLBuffer(null, glBuffer, flags);
+ /**
+ * Creates a CLGLBuffer for memory sharing with the specified OpenGL buffer.
+ * @param glBuffer The OpenGL buffer handle like a vertex buffer or pixel buffer object.
+ * @param glBufferSize The size of the OpenGL buffer in bytes
+ * @param flags optional flags.
+ */
+ public final CLGLBuffer<?> createFromGLBuffer(int glBuffer, long glBufferSize, int flags) {
+ return createFromGLBuffer(null, glBuffer, glBufferSize, flags);
}
- public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(B directBuffer, int glBuffer, Mem... flags) {
- return createFromGLBuffer(directBuffer, glBuffer, Mem.flagsToInt(flags));
+ /**
+ * Creates a CLGLBuffer for memory sharing with the specified OpenGL buffer.
+ * @param directBuffer A direct allocated NIO buffer for data transfers between java and OpenCL.
+ * @param glBuffer The OpenGL buffer handle like a vertex buffer or pixel buffer object.
+ * @param glBufferSize The size of the OpenGL buffer in bytes
+ * @param flags optional flags.
+ */
+ public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(B directBuffer, int glBuffer, long glBufferSize, Mem... flags) {
+ return createFromGLBuffer(directBuffer, glBuffer, glBufferSize, Mem.flagsToInt(flags));
}
- public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(B directBuffer, int glBuffer, int flags) {
- CLGLBuffer<B> buffer = CLGLBuffer.create(this, directBuffer, flags, glBuffer);
+ /**
+ * Creates a CLGLBuffer for memory sharing with the specified OpenGL buffer.
+ * @param directBuffer A direct allocated NIO buffer for data transfers between java and OpenCL.
+ * @param glBuffer The OpenGL buffer handle like a vertex buffer or pixel buffer object.
+ * @param glBufferSize The size of the OpenGL buffer in bytes
+ * @param flags optional flags.
+ */
+ public final <B extends Buffer> CLGLBuffer<B> createFromGLBuffer(B directBuffer, int glBuffer, long glBufferSize, int flags) {
+ CLGLBuffer<B> buffer = CLGLBuffer.create(this, directBuffer, glBufferSize, flags, glBuffer);
memoryObjects.add(buffer);
return buffer;
}