Login  Register

Re: opencl images

Posted by notzed on Jun 24, 2010; 1:53pm
URL: https://forum.jogamp.org/opencl-images-tp918750p919532.html

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.

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.