<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hi, in OpenCL* for CPU</title>
    <link>https://community.intel.com/t5/OpenCL-for-CPU/NULL-image-from-clCreateFromGLTexture2D/m-p/1009123#M3014</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;you should create shared GL-CL context first:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/articles/opencl-and-opengl-interoperability-tutorial" style="font-size: 1em; line-height: 1.5;"&gt;https://software.intel.com/en-us/articles/opencl-and-opengl-interoperability-tutorial&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Oct 2014 10:07:04 GMT</pubDate>
    <dc:creator>Maxim_S_Intel</dc:creator>
    <dc:date>2014-10-01T10:07:04Z</dc:date>
    <item>
      <title>NULL image from clCreateFromGLTexture2D</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/NULL-image-from-clCreateFromGLTexture2D/m-p/1009122#M3013</link>
      <description>I'm getting a NULL cl_mem value.. but CL_SUCCESS as an error code. I'm on x86_64 Arch Linux with Intel® Iris™ Pro Graphics 5200. This is the code I'm trying to run:

&lt;BLOCKQUOTE&gt;
#include &lt;CL&gt;
#include &lt;SDL2&gt;
#include &lt;GL&gt;
#include &lt;STDIO.H&gt;
 
static int WINDOW_WIDTH = 800;
static int WINDOW_HEIGHT = 600;
 
int main() {
  cl_int err;
 
  cl_platform_id platform;
  if (clGetPlatformIDs(1, &amp;amp;platform, NULL) != CL_SUCCESS) {
    fprintf(stderr, "error getting platforms\n");
    return 1;
  }
 
  cl_device_id device;
  if(clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, &amp;amp;device, NULL) != CL_SUCCESS) {
    fprintf(stderr, "error getting devices\n");
    return 1;
  }
 
  cl_context context = clCreateContext(NULL, 1, &amp;amp;device, NULL, NULL, &amp;amp;err);
 
  SDL_Window* w = SDL_CreateWindow("Oh hello, mandelbrot", 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0); 
  SDL_GL_CreateContext(w);
 
  GLint tex;
  glGenTextures(1, &amp;amp;tex);
  glBindTexture(GL_TEXTURE_2D, tex);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexImage2D(
    GL_TEXTURE_2D,
    0,  
    GL_RGBA,
    WINDOW_WIDTH,
    WINDOW_HEIGHT,
    0,  
    GL_RGBA,
    GL_FLOAT,
    NULL
  );
 
  if(glGetError() != GL_NO_ERROR) {
    fprintf(stderr, "OpenGL error\n");
    return 2;
  }
 
  cl_mem img = clCreateFromGLTexture2D(
    context,
    CL_MEM_WRITE_ONLY,
    GL_TEXTURE_2D,
    0,
    tex,
    &amp;amp;err
  );
 
  if(err != CL_SUCCESS) {
    fprintf(stderr, "OpenCL error creating image: %d\n", err);
    return 1;
  } else if (img == NULL) {
    fprintf(stderr, "NULL image\n");
    return 1;
  }
 
  return 0;
}
&lt;/STDIO.H&gt;&lt;/GL&gt;&lt;/SDL2&gt;&lt;/CL&gt;&lt;/BLOCKQUOTE&gt;

Is this a bug?

Thanks!</description>
      <pubDate>Tue, 30 Sep 2014 18:54:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/NULL-image-from-clCreateFromGLTexture2D/m-p/1009122#M3013</guid>
      <dc:creator>Ben_F_1</dc:creator>
      <dc:date>2014-09-30T18:54:32Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/NULL-image-from-clCreateFromGLTexture2D/m-p/1009123#M3014</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;you should create shared GL-CL context first:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/articles/opencl-and-opengl-interoperability-tutorial" style="font-size: 1em; line-height: 1.5;"&gt;https://software.intel.com/en-us/articles/opencl-and-opengl-interoperability-tutorial&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Oct 2014 10:07:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/NULL-image-from-clCreateFromGLTexture2D/m-p/1009123#M3014</guid>
      <dc:creator>Maxim_S_Intel</dc:creator>
      <dc:date>2014-10-01T10:07:04Z</dc:date>
    </item>
    <item>
      <title>Oh good to know!</title>
      <link>https://community.intel.com/t5/OpenCL-for-CPU/NULL-image-from-clCreateFromGLTexture2D/m-p/1009124#M3015</link>
      <description>&lt;P&gt;Oh good to know!&lt;/P&gt;

&lt;P&gt;Turns out my problem is even simpler than that, though.. Apparently cl_khr_gl_sharing isn't supported on my device.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Oct 2014 02:26:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/OpenCL-for-CPU/NULL-image-from-clCreateFromGLTexture2D/m-p/1009124#M3015</guid>
      <dc:creator>Ben_F_1</dc:creator>
      <dc:date>2014-10-03T02:26:02Z</dc:date>
    </item>
  </channel>
</rss>

