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… I’m working with jogamp jocl:
They offer examples and I’m especially interested in this one: … oglinterop

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.glBindBuffer(GL2.GL_ARRAY_BUFFER, glObjects[VERTICES]);
gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);

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: … fault.aspx and the newest jogamp version (tried other versions already)

Does anyone know what’s wrong?

I suggest posting on the jogamp jocl forum. Its quiet but definitely alive, Michael is pretty good at responding.

Maybe add this stuff to the post:

I tried this and get a similar problem. I can’t see any obvious paste-o in JOCL but then i’m using a fairly old version here.

I also tried seeing what’s going on, and clCreateFromGLBuffer() is returning -60 which is:
“CL_INVALID_GL_OBJECT if bufobj is not a GL buffer object or is a GL buffer object but does not have an existing data store.”

But glBufferData has been called so this should be ok.

I’m also using AMD’s SDK.

thanks for your answer. I will try to post this in another forum.

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 :frowning:

Error: clCreateFromGLBuffer failed. (outputImageBuffer) Error code : CL_INVALID_GL_OBJECT


So the problem is not jogamp specific.

Is it possible to use another SDK? Does the Intel SDK supports my ATI graphics card or am I bound to AMDs SDK if I want to use my card?

You’ll have to use the AMD stuff for AMD GPU hardware, intels’ apparently only works on intel cpu’s for that matter.

I did a bit more poking too and it looks like it might be something up with the amd sdk/driver: although i find it hard to believe someone else hasn’t come across it yet - but there’s nothing i can see in the amd forums about it.

I was testing on linux/amd64 fwiw.

It’s a bug that was still not fixed in the amd driver installer.

You have to:
1)uninstall amd drivers,
2)manually clean all junk that it left in the system and
3)reinstall again.

  1. aticonfig --uninstall or (ubuntu) apt-get remove --purge fglrx*

  2. Delete all amd related stuff.
    /etc/alternatives/x86_64-linux-gnu_* to find amd symlinks,

  3. reinstall from the linux binary with --force without creating distribution specific packages. Check for lines like “unable to write to X”. If you find one of them it means that there is still a symlink that was not deleted and you have to restart from point 1.

If the installation went succesfully you may delete again the may delete again the drivers and install a distribution specific package. be sure to follow again point 1 and 2 and don’t use jockey (it introduces again the bug) but install directly from the repository. in ubuntu it’s apt-get install fglrx.

in amd app sdk you find the sample program SimpleGl, if it works then you reinstalled the driver correctly

thank you all!
the problem is solved. I’ve done these simple steps:

  • downloaded some recent driver (not the newest) from ATI
  • uninstalled driver packages (apt-get remove --purge fglrx*)
  • executed driver binary with --force
  • checked for any failure outputs (there where none)
  • reboot


The SimpleGL example runs fine :slight_smile:

Some other benefit: my window manager (compiz) runs faster. I had lags when starting to move a window before this update.

Great. Which version worked BTW?

Actually no matter, i did a poke around and found some cruft left from the previous driver too.

It worked with 8.881-110728a-122950C-ATI. I did not tested other versions…

Now I got the next problem which is maybe jocl specific…
I get unknown failure messages (varying numeric failure code) if I use clCreateFromGLBuffer. But I will open another thread for it as soon as I tried it with C or CPP unfortunately there are no examples in the AMD SDK and I did not found any elsewhere :frowning:

I too am having the same situation when I try to make a CL Buffer from a GL Buffer. From what I can understand, the problem seems to be somehow with the driver of my AMD. Do you think that updating my driver will fix this “Invalid GL Object” problem?

do you mean this situation?

I get unknown failure messages (varying numeric failure code) if I use clCreateFromGLBuffer

if yes: I didn’t tried to update to the newest version
if not and you refer to the problem of the topic, updating the ADM driver solved the problem.