cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

janismac
Journeyman III

OpenCL/GL Interop Setup Problem

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

0 Likes
1 Reply
himanshu_gautam
Grandmaster

Hi,


Have a look at this pdf http://www.khronos.org/registry/cl/specs/opencl-1.2-extensions.pdf. This may help you in solving your problem.

0 Likes