9 Replies Latest reply on Dec 7, 2009 6:34 AM by nou

    Best way to create openGL texture3D from CL buffer?

    Naycon

      I realise this turned out to a wall of text, so here's the short question and if you like you can go on and read the details below:

      I'd like to know if someone has any suggestion on how copying a openCL buffer into a 3D-texture could and/or should be done? Or maybe even better, how I could write directly to a 3D-texture (although it seem this is an extension to openCL which I guess is not implemented yet).

      Details:

      I'm currently trying to implement a fluid renderer in openCL&openGL as a project in a course at my university. Now, my problem is how to render the result of my fluid simulations. I've found a nice ray marcher written in GLSL which can render a texture3D for me. The thing is, I cannot figure out how to get my data from a normal openCL buffer over to a 3D-texture I've created using openGL.

      I've setup openCL with a openGL context, seem to work just fine. Trying to modify some code I found in the Apple openCL noise example, I create a 3D-texture in openGL, create a cl_mem object from it using clCreateFromGLTexture3D (seem to work fine as long as I bind the texture before doing this) and then I plan to either write directly to this buffer (no idea if this would work) or to have another normal openCL buffer and copy its content to the 3D-texture buffer (this is what is done in the apple examlpe).

      However, I cannot try either of the two, because the clEnqueueAcquireGLObjects function causes my program to crash unexpectedly, reporting a search path (something like C:\opencl\runtime\src\, which is not where I've got openCL and Stream installed) ending with cl_gl.cpp:1177: Unimplemented().

      Now, does this mean that the clEnqueueAcquireGLObjects method is currently unimplemented when used together with openGL texture3D objects?

      I've also tried to create a glBuffer and by using glBindBuffer together with glTexImage3D. When doing this, the clEnqueueAcquireGLObjects method seem to work just fine when I call it with the cl_mem object I created from the glBuffer. However, to get the data from the buffer into a 3D-texture, I thought I could use glBuffer and glTexImage3D together, as the openGL specification says that glTexImage3D should get the data from the glBuffer when it is bound. This does not seem to work, at least my texture is all black when rendered.