0
votes

I am trying to display a DOM element in 3D space in AR view using HTMLMesh class from ThreeJS. Every time I try to add the element to the scene, it does not display and also I get this warning in the console:

WebGL: INVALID_VALUE: texImage2D: no canvas

This is my code:

   let html = [
            '<div style="width:100px; height:100px; background-color: red">',
            '<h2>Some info in a panel</h2>',
            '</div>'
        ].join("\n");

    let div = document.createElement("div");

    div.innerHTML = html;

    let object = new THREE.HTMLMesh(div);
    object.position.set(position.x - 2, position.y + 2, position.z - 4);
    this.scene.add(object);

Given the error message, did you set up a canvas? Is anything displayed in the browser? Do you have other objects in your scene?Chris G
Yes, I do have other objects in the scene which are displayed.Enis Mustafaj