javascript - Dynamically switch antialiasing on/off with three.js -


is possible dynamically switch antialiasing on/off three.js? tried following doesn't work @ all:

` var rendereraa = new three.webglrenderer({{ antialias: true }}); rendereraa.setsize( window.innerwidth, window.innerheight ); document.body.appendchild( rendereraa.domelement );  var rendererna = new three.webglrenderer({{ antialias: false }}); rendererna.setsize( window.innerwidth, window.innerheight ); rendererna.domelement = rendereraa.domelement;  var renderer = rendereraa;  function render() {  if (somepredicate) {     renderer = rendereraa; }else {     renderer = rendererna; }  requestanimationframe( render ); renderer.render( scene, camera ); }` 

if active renderer rendererna (somepredicate = false), scene freezes , no change in antialiasing.

i tried set inactive renderers domelement null, didn't help. inspired question:

dynamically turn on/off antialiasing , shadows in webglrenderer

but there no definite answer.

this not possible three.js.

you need recreate entire context allow aa on , off , cannot switch between this. suggest have boolean vars determine if aa on , off prior execution client side. e.h. hd/sd, if hd boolean aa = true, use webglrenderer allow aa , reverse. cannot dynamically change @ runtime.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -