Skip to content

Instantly share code, notes, and snippets.

@Samsy
Created February 2, 2016 11:37
Show Gist options
  • Save Samsy/50332fd0d5f9649cc0f5 to your computer and use it in GitHub Desktop.
Save Samsy/50332fd0d5f9649cc0f5 to your computer and use it in GitHub Desktop.
texture gl
this.tInput = this.webGL_createTexture(2048.0, this.GL.RGBA, this.GL.NEAREST, this.GL.NEAREST, this.GL.UNSIGNED_BYTE, true);
WebglFrag.prototype.webGL_createTexture = function(textureSize, format, maxFilter, minFilter, type, unBind) {
var texture = this.GL.createTexture();
texture.size = textureSize;
this.GL.bindTexture(this.GL.TEXTURE_2D, texture);
this.GL.texImage2D(this.GL.TEXTURE_2D, 0, this.GL.RGBA, this.GL.RGBA, this.GL.UNSIGNED_BYTE, this.canvasSource);
this.GL.texParameteri(this.GL.TEXTURE_2D, this.GL.TEXTURE_MAG_FILTER, this.GL.NEAREST);
this.GL.texParameteri(this.GL.TEXTURE_2D, this.GL.TEXTURE_MIN_FILTER, this.GL.NEAREST);
this.GL.texParameteri(this.GL.TEXTURE_2D, this.GL.TEXTURE_WRAP_S, this.GL.CLAMP_TO_EDGE);
this.GL.texParameteri(this.GL.TEXTURE_2D, this.GL.TEXTURE_WRAP_T, this.GL.CLAMP_TO_EDGE);
return texture;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment