Is there a way to equate the existing HTML with the renderer.domElement? I’m doing this on Vue.js and would like to add things over the top of the renderer viewport using HTML. At the moment I’m doing:
Assigning a DOM element to renderer.domElement is not supported. Consider this property as read-only. Besides, it always has to represent a canvas element.
What does “equate” mean in this context? In any event, if you want to place HTML elements on top of the renderer’s canvas, consider to use an approach like in this example:
Im not sure it’s what you want, but its possible to first create your own canvas element in HTML, style it however you want with CSS and then pass it to the renderer as the canvas parameter. For example:
var myCanvas = document.getElementById("threeCanvas");
var renderer = new THREE.WebGLRenderer({
antialias: true,
canvas: myCanvas,
});
both works, linking an existing canvas or dropping gl.domElement (which also is just a dom canvas element) anywhere you want. and of course you can project html on top of the canvas. it’s just a question of css, the html overlay has to be position:absolute;top:0;left:0.
ideally your template should bring its own canvas element: