Reputation:
I want to use OL3-Cesium to display the globe view in my WPF application using WebBrowser
control.
The sample html file works fine in my IE 11 browser, but if I run the same file through WebBrowser
control it gives a error saying that 'The browser supports WebGL but initialization failed' in Cesium.js.
I made my WPF application compatible with IE 11 by editing key in local machine in registry , but still it did not work. Please help me out with some solution.
Upvotes: 2
Views: 1164
Reputation: 870
I also had the same problem. Almost all suggested solutions involved setting FEATURE_BROWSER_EMULATION
to the current installed version of IE, but Cesium would still return the error The browser supports WebGL but initialization failed
What worked was turning off compatibility mode completely.
SetBrowserFeatureControlKey(
"FEATURE_BROWSER_EMULATION",
fileName,
00000)
And of course still turning on FEATURE_GPU_RENDERING
SetBrowserFeatureControlKey(
"FEATURE_GPU_RENDERING",
fileName,
1)
Upvotes: 0
Reputation: 12448
You mention making WebBrowser
work more like IE11 using a registry key, but you probably need more than one. In particular:
FEATURE_BROWSER_EMULATION
is needed to get IE11 compatibility and access to the WebGL API it providesFEATURE_GPU_RENDERING
is needed to enable hardware-accelerated 3D in the embedded window.Note that Cesium uses failIfMajorPerformanceCaveat
by default, which means that if GPU rendering isn't available, Cesium prefers to fail rather than try to run with software rendering. This can be overridden, but results are predictably bad, so use the GPU registry key instead.
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
"MyApplication.exe" : REG_DWORD = 11
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING
"MyApplication.exe" : REG_DWORD = 1
Here's a great article that explains how to use these registry keys and embed WebGL apps:
Upvotes: 1