Results 1 to 3 of 3

Thread: OpenCL + OpenGL (interop)

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    5

    OpenCL + OpenGL (interop)

    How i may use OpenCL with OpenGL?
    I try line this:

    Code :
    	glGenTextures(1, &texDispMap);
    	glBindTexture(GL_TEXTURE_2D, texDispMap);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, hmap_dim, hmap_dim, 0, GL_RGBA, GL_FLOAT, 0);
     
    	bufCL_Disp = clCreateFromGLTexture2D(ctxGPU, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, texDispMap, &errNum);

    errNum is CL_OUT_OF_HOST_MEMORY
    I go read specs, and I see "context is a valid OpenCL context created from an OpenGL context.".
    Ok... I must create CL context from GL context... How I may do that?
    I must use http://www.khronos.org/registry/cl/exte ... haring.txt extension for that? How? I dont find in cl.h tokens/functions for this extension.

  2. #2
    Senior Member
    Join Date
    Jul 2009
    Location
    Northern Europe
    Posts
    311

    Re: OpenCL + OpenGL (interop)

    The method for getting a context connected to a GL device is implementation dependent. Apple's implementation does it by passing in a special Apple constant to clCreateContext that specifies the Apple CL Share Group you want to use. I'm not sure how it works on other platforms.

  3. #3
    Junior Member
    Join Date
    Nov 2009
    Posts
    5

    Re: OpenCL + OpenGL (interop)

    I found answer here:
    viewtopic.php?f=28&t=2174

    I need use cl_gl.h from ATI Stream SDK, in official headers tokens not founds.

Similar Threads

  1. OpenCL/OpenGL interop on multiple GPU's
    By The.Scotsman in forum OpenCL
    Replies: 1
    Last Post: 09-28-2012, 05:40 AM
  2. OpenCL - OpenGL 2D texture interop
    By majicou in forum OpenCL
    Replies: 4
    Last Post: 01-14-2012, 06:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •