/**
  * Creates an OpenCL context able to share entities with the current OpenGL context.
  *
  * @throws RuntimeException if JavaCL is unable to create an OpenGL-shared OpenCL context.
  */
 public static CLContext createContextFromCurrentGL() {
   RuntimeException first = null;
   for (CLPlatform platform : listPlatforms()) {
     try {
       CLContext ctx = platform.createContextFromCurrentGL();
       if (ctx != null) return ctx;
     } catch (RuntimeException ex) {
       if (first == null) first = ex;
     }
   }
   throw new RuntimeException(
       "Failed to create an OpenCL context based on the current OpenGL context", first);
 }