Login  Register

Re: opencl images

Posted by Michael Bien on Jun 24, 2010; 5:02pm
URL: https://forum.jogamp.org/opencl-images-tp918750p920006.html

sorry for the delay,

On 06/24/2010 03:53 PM, notzed [via jogamp] wrote:
> As a followup i've been working with the opengl stuff in the meantime,
> but have hit some snags.
>
> First a small typo in CLGLTexture2d, for which i've submitted a patch
> to bugzilla.
thank you very much for the patch. its already in:
http://github.com/mbien/jocl/commit/9560f296e01e120279a01ad06189f71cd662ed42



>
> Second, I've been unable to create single channel textures.  Should
> this be expected to work, or am I trying something invalid?
>
> ...
>   gl.glBindTexture(GL_TEXTURE_2D, txts[0]);
>   gl.glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0,
> GL_INTENSITY, GL_UNSIGNED_BYTE, buffer);
>   gl.glBindTexture(GL_TEXTURE_2D, 0);
> ...
>   gl.glFlush();
> ... (same texture)
> rTex = cl.createFromGLTexture2d(GL_TEXTURE_2D, txts[0], 0,
> Mem.READ_WRITE);
>
> But this fails in CLGLTexture2d.createFromGLTexture2d() when it tries
> to get the image size:
>         int width = (int)accessor.getLong(CL_IMAGE_WIDTH);
>
> with:
>
> Exception in thread "AWT-EventQueue-0"
> com.jogamp.opencl.CLException$CLInvalidMemObjectException: error while
> asking for info value
> error: CL_INVALID_MEM_OBJECT (man page:
> http://www.khronos.org/opencl/sdk/1.0/docs/man/xhtml/errors.html)
> gl.reshape
>         at
> com.jogamp.opencl.CLException.checkForError(CLException.java:38)
>         at
> com.jogamp.opencl.CLInfoAccessor.getLong(CLInfoAccessor.java:39)
>         at
> com.jogamp.opencl.gl.CLGLTexture2d.createFromGLTexture2d(CLGLTexture2d.java:42)
>
>
> I tried a bunch of different format types, but only GL_RGBA seems to
> work.

looks valid for me. I'll add a utility method to query all supported
image formats than we will hopefully have the cause of this issue.


best regards,

michael