SHARE
TWEET

texture()

a guest Aug 3rd, 2010 196 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. p.texture = function(pimage){
  2.   if(pimage.name === "Processing.js Instance"){
  3.     var texture = curContext.createTexture();
  4.     curContext.bindTexture(curContext.TEXTURE_2D, texture);
  5.     curContext.texImage2D(curContext.TEXTURE_2D, 0, pimage.externals.canvas);
  6.     curContext.texParameteri(curContext.TEXTURE_2D, curContext.TEXTURE_MAG_FILTER, curContext.LINEAR);
  7.     curContext.texParameteri(curContext.TEXTURE_2D, curContext.TEXTURE_MIN_FILTER, curContext.LINEAR_MIPMAP_LINEAR);
  8.     curContext.texParameteri(curContext.TEXTURE_2D, curContext.TEXTURE_WRAP_T, curContext.CLAMP_TO_EDGE);
  9.     curContext.texParameteri(curContext.TEXTURE_2D, curContext.TEXTURE_WRAP_S, curContext.CLAMP_TO_EDGE);
  10.     curContext.generateMipmap(curContext.TEXTURE_2D);
  11.   } ...
  12.   curTexture.width = pimage.width;
  13.   curTexture.height = pimage.height;
  14.   usingTexture = true;
  15.   curContext.useProgram(programObject3D);
  16.   uniformi(programObject3D, "usingTexture", usingTexture);
  17. };
RAW Paste Data
Top