createTexture(size, opt_data, opt_texture) {
    const gl = this.getGL();
    const texture = opt_texture || gl.createTexture();

    // set params & size
    const level = 0;
    const internalFormat = gl.RGBA;
    const border = 0;
    const format = gl.RGBA;
    const type = gl.UNSIGNED_BYTE;
    gl.bindTexture(gl.TEXTURE_2D, texture);
    if (opt_data) {
      gl.texImage2D(
        gl.TEXTURE_2D,
        level,
        internalFormat,
        format,
        type,
        opt_data
      );
    } else {
      gl.texImage2D(
        gl.TEXTURE_2D,
        level,
        internalFormat,
        size[0],
        size[1],
        border,
        format,
        type,
        null
      );
    }
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);

    return texture;
  }
/**
   * Will create or reuse a given webgl texture and apply the given size. If no image data
   * specified, the texture will be empty, otherwise image data will be used and the `size`
   * parameter will be ignored.
   * Note: wrap parameters are set to clamp to edge, min filter is set to linear.
   * @param {Array<number>} size Expected size of the texture
   * @param {ImageData|HTMLImageElement|HTMLCanvasElement} [opt_data] Image data/object to bind to the texture
   * @param {WebGLTexture} [opt_texture] Existing texture to reuse
   * @return {WebGLTexture} The generated texture
   * @api
   */
Will create or reuse a given webgl texture and apply the given size. If no image data
specified, the texture will be empty, otherwise image data will be used and the `size`
parameter will be ignored.
Note: wrap parameters are set to clamp to edge, min filter is set to linear.
Will create or reuse a given webgl texture and apply the given size . If no image data specified the texture will be empty otherwise image data will be used and the ` size ` parameter will be ignored . Note : wrap parameters are set to clamp to edge min filter is set to linear .
createTexture(size, opt_data, opt_texture) {
    const gl = this.getGL();
    const texture = opt_texture || gl.createTexture();
    const level = 0;
    const internalFormat = gl.RGBA;
    const border = 0;
    const format = gl.RGBA;
    const type = gl.UNSIGNED_BYTE;
    gl.bindTexture(gl.TEXTURE_2D, texture);
    if (opt_data) {
      gl.texImage2D(
        gl.TEXTURE_2D,
        level,
        internalFormat,
        format,
        type,
        opt_data
      );
    } else {
      gl.texImage2D(
        gl.TEXTURE_2D,
        level,
        internalFormat,
        size[0],
        size[1],
        border,
        format,
        type,
        null
      );
    }
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
    return texture;
  }
createTexture ( size , opt_data , opt_texture ) { const gl = this . getGL ( ) ; const texture = opt_texture || gl . createTexture ( ) ; const level = 0 ; const internalFormat = gl . RGBA ; const border = 0 ; const format = gl . RGBA ; const type = gl . UNSIGNED_BYTE ; gl . bindTexture ( gl . TEXTURE_2D , texture ) ; if ( opt_data ) { gl . texImage2D ( gl . TEXTURE_2D , level , internalFormat , format , type , opt_data ) ; } else { gl . texImage2D ( gl . TEXTURE_2D , level , internalFormat , size [ 0 ] , size [ 1 ] , border , format , type , null ) ; } gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_MIN_FILTER , gl . LINEAR ) ; gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_WRAP_S , gl . CLAMP_TO_EDGE ) ; gl . texParameteri ( gl . TEXTURE_2D , gl . TEXTURE_WRAP_T , gl . CLAMP_TO_EDGE ) ; return texture ; }
Will create or reuse a given webgl texture and apply the given size.
Will create or reuse a given webgl texture and apply the given size .
// set params & size