B2G/gecko/browser/devtools/tilt/TiltGL.jsm
/**
   * Initializes a texture from a pre-existing image or canvas.
   *
   * @param {Object} aContext
   *                 a WebGL context
   * @param {Image} aImage
   *                the source image or canvas
   * @param {Object} aProperties
   *                 an object containing some of the following properties:
   *         {Image} source: the source image for the texture
   *        {String} format: the format of the texture ("RGB" or "RGBA")
   *        {String} fill: optional, color to fill the transparent bits
   *        {String} stroke: optional, color to draw an outline
   *        {Number} strokeWeight: optional, the width of the outline
   *        {String} minFilter: either "nearest" or "linear"
   *        {String} magFilter: either "nearest" or "linear"
   *        {String} wrapS: either "repeat" or "clamp"
   *        {String} wrapT: either "repeat" or "clamp"
   *       {Boolean} mipmap: true if should generate mipmap
   *
   * @return {WebGLTexture} the created texture
   */
Initializes a texture from a pre-existing image or canvas.

@return {WebGLTexture} the created texture
Initializes a texture from a pre - existing image or canvas . @return { WebGLTexture } the created texture
function TGLTU_create(aContext, aProperties)
  {
    aProperties = aProperties || {};
    if (!aProperties.source) {
      return null;
    }
    let gl = aContext;
    let width = aProperties.source.width;
    let height = aProperties.source.height;
    let format = gl[aProperties.format || "RGB"];
    let source = this.resizeImageToPowerOfTwo(aProperties);
    let texture = gl.createTexture();
    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.texImage2D(gl.TEXTURE_2D, 0, format, format, gl.UNSIGNED_BYTE, source);
    this.setTextureParams(gl, aProperties);
    gl.bindTexture(gl.TEXTURE_2D, null);
    texture.width = width;
    texture.height = height;
    texture.id = this._count++;
    return texture;
  }
function TGLTU_create ( aContext , aProperties ) { aProperties = aProperties || { } ; if ( ! aProperties . source ) { return null ; } let gl = aContext ; let width = aProperties . source . width ; let height = aProperties . source . height ; let format = gl [ aProperties . format || "RGB" ] ; let source = this . resizeImageToPowerOfTwo ( aProperties ) ; let texture = gl . createTexture ( ) ; gl . bindTexture ( gl . TEXTURE_2D , texture ) ; gl . texImage2D ( gl . TEXTURE_2D , 0 , format , format , gl . UNSIGNED_BYTE , source ) ; this . setTextureParams ( gl , aProperties ) ; gl . bindTexture ( gl . TEXTURE_2D , null ) ; texture . width = width ; texture . height = height ; texture . id = this . _count ++ ; return texture ; }
Initializes a texture from a pre-existing image or canvas.
Initializes a texture from a pre - existing image or canvas .
// make sure the properties argument is an object // make sure the image is power of two before binding to a texture // first, create the texture to hold the image data // attach the image data to the newly create texture // do some cleanup // remember the width and the height // generate an id for the texture