Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there WebGL support in Flutter WebView?

Tags:

flutter

EDIT 5/28/2020: Not sure when exactly this was fixed, but as of Flutter 1.17.0, I no longer have this problem.

I've been trying to implement an iframe in Flutter WebView that requires WebGL (it displays a 3d model).

However, I get a warning saying WebGL in my browser is supported but not enabled. Here's a snippet for getting to https://get.webgl.org:

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class ModelView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Model View'),
      ),
      body: Container(
        child: WebView(
          initialUrl: 'https://get.webgl.org',
          javascriptMode: JavascriptMode.unrestricted,
        ),
      ),
    );
  }
}

Which displays:

Flutter WebView WebGL

Is there a way to enable WebGL for WebView? Or is it impossible right now?

like image 741
mertcanb Avatar asked Nov 07 '22 13:11

mertcanb


1 Answers

webview_flutter on Android uses Platform Views to embed Android WebView while WKWebView is used on iOS. Both have WebGL support so displaying https://get.webgl.org/ should work fine.

like image 114
Omatt Avatar answered Nov 15 '22 08:11

Omatt