Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devwiki:three_js [2022/07/04 18:45] – [Three.js Problem and Solution] ying | devwiki:three_js [2022/07/17 11:49] (current) – [Browse Support] ying | ||
---|---|---|---|
Line 28: | Line 28: | ||
* https:// | * https:// | ||
+ | ====== Browse Support ====== | ||
+ | |||
+ | * some feature using WebGL 2.0 and some old browser or some mobile browser may not support it, | ||
+ | * you can use code to detect webgl2 support and dynamic change the way of coding to support other browser | ||
+ | * webgl2 support browser tabel: https:// | ||
+ | |||
+ | * check webgl2 support <code javascript> | ||
+ | // check webgl2 support for multi sample version | ||
+ | const gl = document.createElement(' | ||
+ | if (!gl) { | ||
+ | alert(' | ||
+ | console.log(' | ||
+ | } else { | ||
+ | console.log(' | ||
+ | } | ||
+ | </ | ||
====== Tools ====== | ====== Tools ====== | ||
Line 392: | Line 408: | ||
* language based texture switch <code javascript> | * language based texture switch <code javascript> | ||
+ | // method 1: (works in firefox, not in chrome) | ||
if(child.name == " | if(child.name == " | ||
lang_texture_geo = child | lang_texture_geo = child | ||
if(main_lang==" | if(main_lang==" | ||
lang_texture_geo.material.map.image.src = " | lang_texture_geo.material.map.image.src = " | ||
+ | } | ||
+ | } | ||
+ | // method 2: (works in both firefox and chrome) | ||
+ | const main_texLoader = new THREE.TextureLoader(load_manager) | ||
+ | const cn_text_ctex = main_texLoader.load(" | ||
+ | cn_text_ctex.flipY = false; | ||
+ | if(child.name == " | ||
+ | lang_texture_geo = child | ||
+ | if(main_lang == " | ||
+ | child.material.map = cn_text_ctex; | ||
} | } | ||
} | } |