diff options
author | Sven Gothel <[email protected]> | 2013-10-12 23:36:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-12 23:36:51 +0200 |
commit | ec14381e0bd681c354de1a002894a628f8bf69e5 (patch) | |
tree | c7c057b10538345fbd85e446ff7ef23ed2f4b57b /src/com/jogamp/opencl/gl/CLGLImage2d.java | |
parent | 8fefade93b3b48d5d6d3233af48c483e335203f3 (diff) |
Bug 579: Use result value in checkForError(..) for CLGLTexture2d.createFromGL*, CLGLTexture3d.createFromGL*, CLGLImage2d.createFromGL* and CLGLBuffer.createFromGL* - instead of returned 'id'
Thank you Johan & Daniel !
Using your original patch, I went through the other CLGL[Texture*|Image2d|Buffer] classes
and ensured all are handled the same.
Reported and 1st patch provided by: Johan <[email protected]>
Confirmed by: Daniel Balog <[email protected]>
Diffstat (limited to 'src/com/jogamp/opencl/gl/CLGLImage2d.java')
-rw-r--r-- | src/com/jogamp/opencl/gl/CLGLImage2d.java | 20 |
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); } |