Cannot run WebGL content on WebView

旧城冷巷雨未停 提交于 2019-12-25 01:38:47

问题


I am trying to open a webpage with WebGL content from wxPython WebView. The engine used by WebView, webkit, has WebGL support.
How can I render the the WebGL content inside WebView?

The complete code used by me:

import wx
import wx.html2


class MyBrowser(wx.Frame):
    def __init__(self, *args, **kwds):
        wx.Frame.__init__(self, *args, **kwds)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.browser = wx.html2.WebView.New(self)
        sizer.Add(self.browser, 1, wx.EXPAND, 10)
        self.SetSizer(sizer)
        self.Maximize()


if __name__ == '__main__':
    app = wx.App()
    dialog = MyBrowser(None, -1)
    dialog.browser.LoadURL("https://get.webgl.org/")
    dialog.Show()
    app.MainLoop()

gives the below screen

Also, opening https://whatsmybrowser.org from the WebView identifies the browser as Safari (while using Ubuntu). See full description here: https://whatsmybrowser.org/b/X43YSDV.


回答1:


I could not find support for webGL inside wxpython webview.
My solution was to use cefpython. cefpython embeds full chromium browser inside python applications. Here's an example of wxpython using cefpython: https://github.com/cztomczak/cefpython/blob/master/examples/wxpython.py.



来源:https://stackoverflow.com/questions/55723043/cannot-run-webgl-content-on-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!