summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/jogamp/opencl/gl/CLGLBuffer.java10
-rw-r--r--src/com/jogamp/opencl/gl/CLGLImage2d.java20
-rw-r--r--src/com/jogamp/opencl/gl/CLGLTexture2d.java15
-rw-r--r--src/com/jogamp/opencl/gl/CLGLTexture3d.java16
4 files changed, 32 insertions, 29 deletions
diff --git a/src/com/jogamp/opencl/gl/CLGLBuffer.java b/src/com/jogamp/opencl/gl/CLGLBuffer.java
index 7d41b0eb..a9fc49cd 100644
--- a/src/com/jogamp/opencl/gl/CLGLBuffer.java
+++ b/src/com/jogamp/opencl/gl/CLGLBuffer.java
@@ -40,7 +40,7 @@ import javax.media.opengl.GLContext;
/**
* Shared buffer between OpenGL and OpenCL contexts.
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements CLGLObject {
@@ -56,16 +56,16 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C
}
- static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, long size, int flags, int glObject) {
+ static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, long size, int flags, int glBuffer) {
checkBuffer(directBuffer, flags);
CLGL clgli = (CLGL)getCL(context);
int[] result = new int[1];
- long id = clgli.clCreateFromGLBuffer(context.ID, flags, glObject, result, 0);
- CLException.checkForError(result[0], "can not create CLGLObject from #"+glObject);
+ long id = clgli.clCreateFromGLBuffer(context.ID, flags, glBuffer, result, 0);
+ CLException.checkForError(result[0], "can not create CLGLObject from glBuffer #"+glBuffer);
- return new CLGLBuffer<B>(context, directBuffer, id, glObject, size, flags);
+ return new CLGLBuffer<B>(context, directBuffer, id, glBuffer, size, flags);
}
static <B extends Buffer> void checkBuffer(B directBuffer, int flags) throws IllegalArgumentException {
diff --git a/src/com/jogamp/opencl/gl/CLGLImage2d.java b/src/com/jogamp/opencl/gl/CLGLImage2d.java
index dd6b9d5a..954a2334 100644
--- a/src/com/jogamp/opencl/gl/CLGLImage2d.java
+++ b/src/com/jogamp/opencl/gl/CLGLImage2d.java
@@ -31,17 +31,18 @@ package com.jogamp.opencl.gl;
import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.CLContext;
+import com.jogamp.opencl.CLException;
import com.jogamp.opencl.CLImage2d;
import com.jogamp.opencl.CLImageFormat;
import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
+
import java.nio.Buffer;
-import javax.media.opengl.GLContext;
-import static com.jogamp.opencl.llb.CL.*;
+import javax.media.opengl.GLContext;
/**
* 2D OpenCL image representing an OpenGL renderbuffer.
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLObject {
@@ -55,7 +56,7 @@ public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLO
this.GLID = glid;
}
- static <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(CLContext context, B directBuffer, int flags, int glObject) {
+ static <B extends Buffer> CLGLImage2d<B> createFromGLRenderbuffer(CLContext context, B directBuffer, int flags, int renderbuffer) {
CLGLBuffer.checkBuffer(directBuffer, flags);
@@ -63,19 +64,20 @@ public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLO
int[] result = new int[1];
CLGL clgli = (CLGL)cl;
- long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, glObject, result, 0);
+ long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, renderbuffer, result, 0);
+ CLException.checkForError(result[0], "can not create CLGLImage2d from renderbuffer #"+renderbuffer+".");
- return createImage(context, id, directBuffer, glObject, flags);
+ return createImage(context, id, directBuffer, renderbuffer, flags);
}
static <B extends Buffer> CLGLImage2d<B> createImage(CLContext context, long id, B directBuffer, int glObject, int flags) {
CLImageInfoAccessor accessor = new CLImageInfoAccessor(getCL(context), id);
CLImageFormat format = createUninitializedImageFormat();
- accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null);
+ accessor.getInfo(CL.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null);
- int width = (int)accessor.getLong(CL_IMAGE_WIDTH);
- int height = (int)accessor.getLong(CL_IMAGE_HEIGHT);
+ int width = (int)accessor.getLong(CL.CL_IMAGE_WIDTH);
+ int height = (int)accessor.getLong(CL.CL_IMAGE_HEIGHT);
return new CLGLImage2d<B>(context, directBuffer, format, accessor, width, height, id, glObject, flags);
}
diff --git a/src/com/jogamp/opencl/gl/CLGLTexture2d.java b/src/com/jogamp/opencl/gl/CLGLTexture2d.java
index 7cbd95d5..64ac4e0b 100644
--- a/src/com/jogamp/opencl/gl/CLGLTexture2d.java
+++ b/src/com/jogamp/opencl/gl/CLGLTexture2d.java
@@ -30,17 +30,16 @@ package com.jogamp.opencl.gl;
import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.CLContext;
+import com.jogamp.opencl.CLException;
import com.jogamp.opencl.CLImageFormat;
import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
import com.jogamp.opencl.llb.gl.CLGL;
-import java.nio.Buffer;
-import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.llb.CL.*;
+import java.nio.Buffer;
/**
* 2D OpenCL image representing an 2D OpenGL texture.
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
public class CLGLTexture2d<B extends Buffer> extends CLGLImage2d<B> implements CLGLTexture {
@@ -63,15 +62,15 @@ public class CLGLTexture2d<B extends Buffer> extends CLGLImage2d<B> implements C
CLGL clgli = (CLGL)cl;
long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0);
- checkForError((int)id, "can not share memory with texture #"+texture+".");
+ CLException.checkForError(result[0], "can not create CLGLTexture2d from texture #"+texture+".");
CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id);
CLImageFormat format = createUninitializedImageFormat();
- accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null);
+ accessor.getInfo(CL.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null);
- int width = (int)accessor.getLong(CL_IMAGE_WIDTH);
- int height = (int)accessor.getLong(CL_IMAGE_HEIGHT);
+ int width = (int)accessor.getLong(CL.CL_IMAGE_WIDTH);
+ int height = (int)accessor.getLong(CL.CL_IMAGE_HEIGHT);
return new CLGLTexture2d<B>(context, directBuffer, format, accessor, target, mipLevel, width, height, id, texture, flags);
diff --git a/src/com/jogamp/opencl/gl/CLGLTexture3d.java b/src/com/jogamp/opencl/gl/CLGLTexture3d.java
index 8dd2682c..fdc2ba79 100644
--- a/src/com/jogamp/opencl/gl/CLGLTexture3d.java
+++ b/src/com/jogamp/opencl/gl/CLGLTexture3d.java
@@ -31,17 +31,18 @@ package com.jogamp.opencl.gl;
import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.CLContext;
+import com.jogamp.opencl.CLException;
import com.jogamp.opencl.CLImage3d;
import com.jogamp.opencl.CLImageFormat;
import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
+
import java.nio.Buffer;
-import javax.media.opengl.GLContext;
-import static com.jogamp.opencl.llb.CL.*;
+import javax.media.opengl.GLContext;
/**
* 3D OpenCL image representing an 3D OpenGL texture.
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
public class CLGLTexture3d<B extends Buffer> extends CLImage3d<B> implements CLGLObject, CLGLTexture {
@@ -70,15 +71,16 @@ public class CLGLTexture3d<B extends Buffer> extends CLImage3d<B> implements CLG
CLGL clgli = (CLGL)cl;
long id = clgli.clCreateFromGLTexture3D(context.ID, flags, target, mipLevel, texture, result, 0);
+ CLException.checkForError(result[0], "can not create CLGLTexture3d from texture #"+texture+".");
CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id);
CLImageFormat format = createUninitializedImageFormat();
- accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null);
+ accessor.getInfo(CL.CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null);
- int width = (int)accessor.getLong(CL_IMAGE_WIDTH);
- int height = (int)accessor.getLong(CL_IMAGE_HEIGHT);
- int depth = (int)accessor.getLong(CL_IMAGE_DEPTH);
+ int width = (int)accessor.getLong(CL.CL_IMAGE_WIDTH);
+ int height = (int)accessor.getLong(CL.CL_IMAGE_HEIGHT);
+ int depth = (int)accessor.getLong(CL.CL_IMAGE_DEPTH);
return new CLGLTexture3d<B>(context, directBuffer, format, accessor, target, mipLevel, width, height, depth, id, texture, flags);
}