Login  Register

cl.createFromGLTexture2d is not working

Posted by AlexRNL on Mar 17, 2011; 5:22pm
URL: https://forum.jogamp.org/cl-createFromGLTexture2d-is-not-working-tp2694449.html

Hi everybody!

I recently set up JOCL on my project to compute more efficient (hopefully :) ) texture data. I was doing that with OpenGL but by having a look at OpenCL, it seemed that computation should be faster.

I was working with a TextureRenderer Object in OpenGL and I tried to send it to an openCL kernel. So I tried to use the method cl.createFromGLTexture2d which sounded appropriate... But whenever I tried to launch my program it failed on the call of this function and throw an CLInvalidMemObjectException !

Here's my code:

private void generateTexture () {
        [...] /* code which update the texture*/
        textureRenderer.getTexture().bind();
        gl.glFlush();
        fullTex = cl.createFromGLTexture2d(textureRenderer.getTexture().getTarget(), TextureRenderer.getTexture().getTextureObject(), 0, Mem.READ_WRITE);
}


And what the stack trace:

Caused by: com.jogamp.opencl.CLException$CLInvalidMemObjectException: error while asking for info value [error: CL_INVALID_MEM_OBJECT]
        at com.jogamp.opencl.CLException.checkForError(CLException.java:67)
        at com.jogamp.opencl.CLInfoAccessor.getLong(CLInfoAccessor.java:67)
        at com.jogamp.opencl.gl.CLGLTexture2d.createFromGLTexture2d(CLGLTexture2d.java:70)
        at com.jogamp.opencl.gl.CLGLContext.createFromGLTexture2d(CLGLContext.java:255)
        at com.jogamp.opencl.gl.CLGLContext.createFromGLTexture2d(CLGLContext.java:243)
        at sytar.processing.BitMap.generateTexture(BitMap.java:286)
        [...]


Does anyone has an idea to solve this problem? I've been working on that for quite a while now and i can't figure out what's wrong...

Thanks to any helper ;)