diff --git a/src/c_wrapper/gl_obj.cpp b/src/c_wrapper/gl_obj.cpp index db6952379f6b1c5586e194b6035b805e9e96e45e..ee4cdb2e2e42f622b755fb973e836a8da2048ee9 100644 --- a/src/c_wrapper/gl_obj.cpp +++ b/src/c_wrapper/gl_obj.cpp @@ -143,10 +143,16 @@ cl_context_properties get_apple_cgl_share_group() { #ifdef __APPLE__ - CGLContextObj kCGLContext = CGLGetCurrentContext(); - CGLShareGroupObj kCGLShareGroup = CGLGetShareGroup(kCGLContext); - - return (cl_context_properties)kCGLShareGroup; + #ifdef HAVE_GL + CGLContextObj kCGLContext = CGLGetCurrentContext(); + CGLShareGroupObj kCGLShareGroup = CGLGetShareGroup(kCGLContext); + + return (cl_context_properties)kCGLShareGroup; + #else + throw clerror("get_apple_cgl_share_group unavailable: " + "GL interop not compiled", + CL_INVALID_VALUE); + #endif #else throw clerror("get_apple_cgl_share_group unavailable: non-Apple platform", CL_INVALID_VALUE);