- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
How to get webgl context for drawing?
This code does not work:
var canvas = document.createElement("canvas"); var namesContexts = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"]; var gl = null; for (var ii = 0; ii < namesContexts.length; ii++) { try { gl = canvas.getContext(namesContexts[ii]); } catch (e) {} if (gl) { break; } }
After executing this code ... gl==null
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi, if "gl==null", it means that the browser is not support WebGL. WebGL is not commonly supported on many mobile platforms.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Anatoly - I don't understand. Are you saying you got it to work?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
in mobile chrome (if you enable the hardware rasterization) gl == WebglRenderingContext
in intel xdk gl == null
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi, could you make sure the value you get is "null" in XDK emulator? The XDK emulator is actually an application runs inside node-Webkit which uses web runtime based on Chrome browser. The chrome support WebGL, that means the XDK emulator should support WebGL as well without installing any plugin. I used "console.log(gl)" to have a check, and the output is the object "WebGLRenderingContext". I attach the image, so that you could also double check with your code.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
in Mobile chrome( android): gl==webglRenderingContext
in Intel XDK Emulator: gl==webglRenderingContext
Intel xdk debug mode: gl==null
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
The Debug tab is running in a Crosswalk webview (it is similar to building a Crosswalk app). According to the Crosswalk FAQ pages (https://crosswalk-project.org/documentation/about/faq.html):
Why won't WebGL work in Crosswalk on my device?
Chromium has a blacklist of GPUs which are know to cause stability and/or conformance problems when running WebGL. Chromium will disable WebGL if running on a device with one of the GPUs in this list.
Crosswalk uses the same blacklist. Consequently, if Crosswalk is running on a device with a blacklisted GPU, WebGL is disabled by default.
For more information about which GPUs are blacklisted and when, see the Khronos WebGL wiki.
You are likely testing on such a device.
To fix this, you need to see this FAQ > https://software.intel.com/en-us/xdk/faqs/crosswalk#crosswalk-animatable <
