title: how to create CL GL interop context?
body: <p>For openGL i use lwjgl and for openCL i use jocl.</p>
  
  <p>my video card rx550.</p>
  
  <p>os win10pro.</p>
  
  <p>This my GL Init method, i run it first.</p>
  
  <pre><code>static long window;
  
  static void initGL(){
      if(glfwInit()!=true){
          System.err.println("INIT_GLFW_FAILED");
          System.exit(1);
      }
  
      window=glfwCreateWindow( w, h, "test", 0, 0);
      glfwShowWindow(window);
      glfwMakeContextCurrent(window);
      GL.createCapabilities();
  
      glViewport(0, 0, w, h);
      glOrtho(0, w, h, 0, -1, 1);
  
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glEnable(GL_TEXTURE_2D);
      glEnable(GL_TEXTURE_3D);
  
  }
  </code></pre>
  
  <p>This my CL init method, i run it second.</p>
  
  <pre><code>static void initCL(){
      CL.setExceptionsEnabled(true);
  
      int numPlatformsArray[] = new int[1];
      clGetPlatformIDs(0, null, numPlatformsArray);
      numPlatforms=numPlatformsArray[0];
  
      cl_platform_id platforms[] = new cl_platform_id[numPlatforms];
      clGetPlatformIDs(platforms.length, platforms, null);
      cl_platform_id platform = platforms[platformIndex];
  
      int numDevicesArray[] = new int[1];
      clGetDeviceIDs(platform, deviceType, 0, null, numDevicesArray);
      numDevices = numDevicesArray[0];
  
      cl_device_id devices[] = new cl_device_id[numDevices];
      clGetDeviceIDs(platform, deviceType, numDevices, devices, null);
      device = devices[deviceIndex];
  
  
      cl_context_properties contextProperties = new cl_context_properties();
      contextProperties.addProperty(CL_GL_CONTEXT_KHR, 
      glfwGetCurrentContext());//wglGetCurrentContext()
      contextProperties.addProperty(CL_WGL_HDC_KHR, wglGetCurrentDC());
      contextProperties.addProperty(CL_CONTEXT_PLATFORM, platform);
  
      context = clCreateContextFromType(contextProperties, CL_DEVICE_TYPE_GPU, 
      null, null, null);
  
      commandQueue = clCreateCommandQueue(context, device, 0, null);
  
      mprogram = clCreateProgramWithSource(context,1, new String[]{ program }, null, null);
  
      clBuildProgram(mprogram, numDevices, devices, null, null, null);
  
      mkernel = clCreateKernel(mprogram, "sampleKernel", null);
  
      System.out.println("CLinit done");
  }
  </code></pre>
  
  <p>And in this part he say CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR.</p>
  
  <pre><code>context = clCreateContextFromType(contextProperties, CL_DEVICE_TYPE_GPU, null, null, null);
  </code></pre>
  
  <p>I try change glfwGetCurrentContext() to wglGetCurrentContext() and to window but he say it again.</p>
  
  <p>But if i remove this line</p>
  
  <pre><code>contextProperties.addProperty(CL_WGL_HDC_KHR, wglGetCurrentDC());
  </code></pre>
  
  <p>he run perfectly, but if i try to put texture3d</p>
  
  <pre><code>clCreateFromGLTexture3D(context, CL_MEM_READ_ONLY, GL_TEXTURE_3D, 0, GL_TEXTURE_3D, null);
  </code></pre>
  
  <p>he say CL_INVALID_CONTEXT.</p>