private long createContext(final long platform, final long[] devices, long window) {
        try (MemoryStack stack = MemoryStack.stackPush()) {

            final int propertyCount = 2 + 4 + 1;
            final PointerBuffer properties = stack.callocPointer(propertyCount + devices.length);

            // set sharing properties
            // https://github.com/glfw/glfw/issues/104
            // https://github.com/LWJGL/lwjgl3/blob/master/modules/core/src/test/java/org/lwjgl/demo/opencl/Mandelbrot.java
            // TODO: test on Linux and MacOSX
            switch (Platform.get()) {
                case WINDOWS:
                    properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR)
                            .put(org.lwjgl.glfw.GLFWNativeWGL.glfwGetWGLContext(window))
                            .put(KHRGLSharing.CL_WGL_HDC_KHR)
                            .put(org.lwjgl.opengl.WGL.wglGetCurrentDC());
                    break;
                case LINUX:
                    properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR)
                            .put(org.lwjgl.glfw.GLFWNativeGLX.glfwGetGLXContext(window))
                            .put(KHRGLSharing.CL_GLX_DISPLAY_KHR)
                            .put(org.lwjgl.glfw.GLFWNativeX11.glfwGetX11Display());
                    break;
                case MACOSX:
                    properties.put(APPLEGLSharing.CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE)
                            .put(org.lwjgl.opengl.CGL.CGLGetShareGroup(org.lwjgl.opengl.CGL.CGLGetCurrentContext()));
                    break;
                default:
                    break; // Unknown Platform, do nothing.
            }

            properties.put(CL_CONTEXT_PLATFORM).put(platform);
            properties.put(0);
            properties.flip();

            final IntBuffer error = stack.callocInt(1);
            final PointerBuffer deviceBuffer = stack.callocPointer(devices.length);
            for (final long deviceId : devices) {
                deviceBuffer.put(deviceId);
            }

            deviceBuffer.flip();

            long context = CL10.clCreateContext(properties, deviceBuffer, null, 0, error);
            Utils.checkError(error, "clCreateContext");

            return context;
        }
    }
Returns a list of the available platforms, filtered by the specified
filter.
<p>
Copied from the old release

@return the available platforms
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglContext.java