three.js dom id of canvas element used for webgl renderer
canvas, dom, element, three.js
Solution
var canvas = document.getElementById("canvasID");
renderer = new THREE.WebGLRenderer({ canvas: canvas });
Problem
I'd like to get the id of the canvas element automatically created by three.js. Alternately, I would be equally happy (perhaps more so) with the ability to pass along a preexisting canvas element id during construction. After researching, I tried this: ``` renderer = new THREE.WebGLRenderer( { canvas: my_canvas } ); ``` without success (it is from a pretty old build, but was hoping it would work). Perhaps some parameter syntax has changed since 2 years ago? (my_canvas being the id of the canvas, also tried passing along the context, no luck) Finally I tried: ``` document.getElementsByTagName('canvas'); ``` which returned nothing... that was a puzzler and the proverbial straw that led me to post here. Any insight appreciated, thanks! (I now have voting rights)