Login  Register

CL_INVALID_GL_OBJECT

Posted by kaesemeister on Oct 27, 2011; 9:17am
URL: https://forum.jogamp.org/CL-INVALID-GL-OBJECT-tp3457129.html

Hi,

I startet experimenting with OpenCL. First tests are done. Now I am trying to check out Interoperability with OpenGL. I want to manipulate an OpenGL Buffer directly.. Therefore I tried this example: https://github.com/mbien/jocl-demos/tree/master/src/com/jogamp/opencl/demos/joglinterop

Unfortunately I get errors whenever they try to create a CL Buffer from a GL Buffer:
clBuffer = clContext.createFromGLBuffer(glObjects[VERTICES], BUFFER_SIZE, CLGLBuffer.Mem.WRITE_ONLY);

glObjects[VERTICES] contains a valid opengl bufferId which was initialized as follows:
gl.glGenBuffers(glObjects.length, glObjects, 0);
gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, glObjects[VERTICES]);
gl.glBufferData(GL2.GL_ARRAY_BUFFER, BUFFER_SIZE, null, GL2.GL_DYNAMIC_DRAW);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);

Does anyone know what could be the problem? Is this maybe a hardware limitation?
There is a compatibility check in the code which passes:
... d.isGLMemorySharingSupported() ... 

I am using this SDK: http://developer.amd.com/sdks/AMDAPPSDK/downloads/Pages/default.aspx and the newest jogamp version (tried other versions already)

I've done some more tests to find out what's the problem: The AMD SDK delivers some c examples. I compiled them and get the same error, whenever opengl interoperability is used :(
Error: clCreateFromGLBuffer failed. (outputImageBuffer) Error code : CL_INVALID_GL_OBJECT
example: $(AMDAPPSDKSAMPLESROOT)/opt/AMDAPP/samples/opencl/cl/app/SimpleGL