aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/gl/CLGLImage2d.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/jogamp/opencl/gl/CLGLImage2d.java')
-rw-r--r--src/com/jogamp/opencl/gl/CLGLImage2d.java20
1 files changed, 11 insertions, 9 deletions
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);
}