SFML community forums
Help => General => Topic started by: Yours3lf on October 10, 2011, 07:44:50 pm
-
Hi,
I'm currently experimenting with OpenCL OpenGL interoperation, so to set up my context I'd need the current context and the current display id.
with glx it looks like this:
cl_context_properties properties[] =
{
CL_GL_CONTEXT_KHR, (cl_context_properties)glXGetCurrentContext(), //the GL context id
CL_GLX_DISPLAY_KHR, (cl_context_properties)glXGetCurrentDisplay(), //the display id
CL_CONTEXT_PLATFORM, (cl_context_properties)the_cl_platform, //this is set up by me
0
};
cl_int error;
//the_cl_device is set up by me
the_cl_context = clCreateContext(properties, 1, &the_cl_device, 0, 0, &error);
assert(error == CL_SUCCESS);
so how can I get the same GL context id and window id in SFML?
NOTE: I'm on Linux.
here's the pdf that explains CL-GL interop:
http://sa10.idav.ucdavis.edu/docs/sa10-dg-opencl-gl-interop.pdf
Best regards,
Yours3!f
-
wglGetCurrentContext and wglGetCurrentDC ;)
-
Thanks Laurent, but I'm on linux :) so I guess that doesn't apply to me...
Or does it? I tried it but either I have to include something else or that's windows only.
-
Sorry, I thought you were asking for the equivalent on Windows.
You can use your code directly even with SFML, glX calls are still valid if you want to access the current context/window.
-
ok, thanks :) after a quick googling I found that I just need to include GL/glx.h and the glx funcs are working now :)