#include "luaopencl.h"

clGetGLContextInfoKHR_fn __clGetGLContextInfoKHR = NULL;

const cl_context_properties * utilGetCLContextGLProperties()
{
	static cl_context_properties prop[5];

	prop[0] = CL_GL_CONTEXT_KHR;
	
#ifdef WIN32
	prop[1] =  (cl_context_properties)wglGetCurrentContext();
	prop[2] =  CL_WGL_HDC_KHR;
	prop[3] =  (cl_context_properties)wglGetCurrentDC();
#else
	prop[1] =  (cl_context_properties)glXGetCurrentContext();
	prop[2] =  CL_WGL_HDC_KHR;
	prop[3] =  (cl_context_properties)glXGetCurrentDisplay();
#endif
	prop[4] = 0;

	return prop;
}

void utilInitExtensions()
{
	clGetGLContextInfoKHR = (clGetGLContextInfoKHR_fn)clGetExtensionFunctionAddress("clGetGLContextInfoKHR");
}
