three.js - How to resize ThreeJS Renderer in Firefox & Edge -
i have simple web app three.js webgl view. page responsive, need resize 3d view window size changes. works fine in chrome, nothing in firefox, , resizes renders black canvas in edge.
the code i'm using is:
canvaswidth = canvasheight = window.innerwidth < 786 ? window.innerwidth : math.min(window.innerwidth*0.35, 500) renderer.setsize(canvaswidth, canvasheight); camera.aspect = canvaswidth / canvasheight; camera.updateprojectionmatrix();
this code executed on window resize.
the app available @ http://bit.ly/1oeckue
suggestions?
does resize of canvas work in firefox when directly use window.innerwidth
, window.innerheight
this:
camera.aspect = window.innerwidth / window.innerheight; camera.updateprojectionmatrix(); renderer.setsize( window.innerwidth, window.innerheight );
this normal approach three.js examples resize canvas. maybe there problem in way calculate canvaswidth
, canvasheight
variables...
Comments
Post a Comment