WebGL single frame “screenshot” of webGL

前端 未结 2 1032
無奈伤痛
無奈伤痛 2021-01-07 05:12

tried searching for something like this, but I\'ve had no luck. I\'m trying to open a new tab with a screenshot of the current state of my webgl image. Basically, it\'s a

2条回答
  •  天涯浪人
    2021-01-07 05:57

    If you open the window with no URL you can access it's entire DOM directly from the JavaScript that opened the window.

    var w = window.open('', '');
    

    You can then set or add anything you want

    w.document.title = "DNA_screen";
    w.document.body.style.backgroundColor = "red";
    

    And add the screenshot

    var img = new Image();
    img.src = someCanvas.toDataURL();
    w.document.body.appendChild(img);
    

提交回复
热议问题