I have an array of pixel data that is passed from a webgl program. I then process the pixel data for green screening and output the result into a 2d canvas. Considering I am new with Canvas 2d my question is, how do I properly pass image data to the canvas.
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
document.body.appendChild(canvas);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
var SetCanvas = function(data){
var id = ctx.createImageData(window.innerWidth, window.innerHeight);
id.data = data;
ctx.putImageData(data, 0, 0);
};