Deploy WebGL applications as native iOS or Android applications?

后端 未结 8 740
既然无缘
既然无缘 2021-01-30 04:21

Does anyone know of a way in which you can deploy a WebGL app as a native iOS or Android app? Commercial middleware is acceptable, although an open project would be preferable.

8条回答
  •  耶瑟儿~
    2021-01-30 04:34

    WebKit on iOS actually supports WebGL, as of 4.x (not sure which .x version). It is enabled in the webview used by the iAd framework, all other uses of WebKit (Safari and UIWebView) have WebGL disabled.

    It is possible to enable WebGL using private API's (this will not pass the submission process). In your webview subclass:

    - (void)setWebGLEnabled:(BOOL)enableWebGL {
        UIWebDocumentView* webDocumentView = [self _browserView];
        WebView* backingWebView = [webDocumentView webView];
        [backingWebView _setWebGLEnabled:enableWebGL];
    }
    

    (via)

    This will at least allow you to start experimenting with WebGL on iOS.

    Not sure about WebGL support on Android. Fairly recent comments on the issue in the Android tracker suggest it is not available yet.

    A nice support table for WebGL in (mobile) browsers: When can I use WebGL

    Best way to go for now seems to be to include your own WebGL enabled version of WebKit in your application wrapper for both iOS and Android.

提交回复
热议问题