2 Replies Latest reply on Oct 19, 2013 5:43 AM by janismac

    OpenCL/GL Interop Setup Problem

    janismac

      I'd like to use OpenGL for rendering on my graphics card, i.e. I'm looking for some way to write to the framebuffer.

      From what I've found, the way to go is using a shared CL/GL buffer or texture. If there is an easier way, please tell me.

       

      I fail to set up the CL/GL connection and the problem seems to revolve around the clGetExtensionFunctionAddressForPlatform() function.

       

      My development environment:

      Windows7 64-bit

      MS VisualStudio 2012

      AMD APP SDK 2.8.1 (OpenGL 1.2)

      Graphics card: Radeon HD 5770 (Juniper)

      cl_khr_gl_sharing extension supported

       

      When I try to call the function pointer that clGetExtensionFunctionAddressForPlatform() returns I get the following error:

      "Unhandled exception at 0x51EC8B55 in main.exe: 0xC0000005: Access violation reading location 0x51EC8B55."

      But the debugger indicates that 0x51EC8B55 points somewhere into the "OpenCL.dll"

       

      I'm not really sure what to make of this, I'm not too experienced with C.

       

      Here is a reduced runnable version of my code that reproduces the error.

      #include "stdafx.h"
      #include #include 
      int main(int argc, char** argv) 
      {
           cl_platform_id cl_platform;     
           clGetPlatformIDs(1, &cl_platform, NULL);
           cl_device_id devices[32];
           size_t sharing_devices_count;
           clGetGLContextInfoKHR_fn *functionPtr = (clGetGLContextInfoKHR_fn*)clGetExtensionFunctionAddressForPlatform(cl_platform, "clGetGLContextInfoKHR");          
           (*functionPtr)(NULL, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR,32*sizeof(cl_device_id), devices, &sharing_devices_count);
      }
      

       

      I hope you can help me.

       

      Regards, janismac