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);
}

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 ) ; }
creates an opencl context able to share entities with the current opengl context .
