MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / _renderDither

Method _renderDither

src/tools/texture-lab/renderer.js:514–531  ·  view source on GitHub ↗
(params, inputTexture, width, height, flipY = 1.0)

Source from the content-addressed store, hash-verified

512 }
513
514 _renderDither(params, inputTexture, width, height, flipY = 1.0) {
515 const gl = this.gl;
516 const program = this.programs.dither;
517
518 this._useProgram(program, flipY);
519
520 gl.activeTexture(gl.TEXTURE0);
521 gl.bindTexture(gl.TEXTURE_2D, inputTexture);
522
523 gl.uniform1i(program.uniforms.u_image, 0);
524 gl.uniform1i(program.uniforms.u_method, this._ditherMethodToInt(params.method));
525 gl.uniform1i(program.uniforms.u_levels, params.levels);
526 gl.uniform1f(program.uniforms.u_threshold, params.threshold);
527 gl.uniform2f(program.uniforms.u_resolution, width, height);
528 gl.uniform1f(program.uniforms.u_scale, params.scale || 1.0);
529
530 gl.drawArrays(gl.TRIANGLES, 0, 6);
531 }
532
533 _renderHalftone(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
534 const gl = this.gl;

Callers 1

_renderEffectMethod · 0.95

Calls 2

_useProgramMethod · 0.95
_ditherMethodToIntMethod · 0.95

Tested by

no test coverage detected