當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript GL.texImage2D方法代碼示例

本文整理匯總了TypeScript中neuroglancer/webgl/context.GL.texImage2D方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript GL.texImage2D方法的具體用法?TypeScript GL.texImage2D怎麽用?TypeScript GL.texImage2D使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在neuroglancer/webgl/context.GL的用法示例。


在下文中一共展示了GL.texImage2D方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: setTextureData

  setTextureData(gl: GL) {
    let {source} = this;
    let {chunkFormatHandler} = source;
    let {chunkFormat} = chunkFormatHandler;

    let textureLayout: TextureLayout;
    if (this.chunkDataSize === source.spec.chunkDataSize) {
      this.textureLayout = textureLayout = chunkFormatHandler.textureLayout.addRef();
    } else {
      this.textureLayout = textureLayout = chunkFormat.getTextureLayout(gl, this.chunkDataSize);
    }

    let requiredSize = textureLayout.textureWidth * textureLayout.textureHeight *
      chunkFormat.arrayElementsPerTexel;
    let {arrayConstructor} = chunkFormat;
    let data: TypedArray = this.data;
    if (data.constructor !== arrayConstructor) {
      data = new arrayConstructor(data.buffer, data.byteOffset, data.byteLength / arrayConstructor.BYTES_PER_ELEMENT);
    }
    let padded = maybePadArray(data, requiredSize);
    gl.texImage2D(
        gl.TEXTURE_2D,
        /*level=*/0, chunkFormat.textureFormat,
        /*width=*/textureLayout.textureWidth,
        /*height=*/textureLayout.textureHeight,
        /*border=*/0, chunkFormat.textureFormat, chunkFormat.texelType, padded);
  }
開發者ID:j6k4m8,項目名稱:neuroglancer,代碼行數:27,代碼來源:uncompressed_chunk_format.ts

示例2: resizeTexture

export function resizeTexture(gl: GL, texture: WebGLTexture, width: number, height: number,
                              format: number = gl.RGBA, dataType: number = gl.UNSIGNED_BYTE) {
  gl.activeTexture(gl.TEXTURE0 + gl.tempTextureUnit);
  gl.bindTexture(gl.TEXTURE_2D, texture);
  setRawTextureParameters(gl);
  gl.texImage2D(
      gl.TEXTURE_2D, 0,
      /*internalformat=*/format,
      /*width=*/width,
      /*height=*/height,
      /*border=*/0,
      /*format=*/format, dataType, null);
  gl.bindTexture(gl.TEXTURE_2D, null);
}
開發者ID:j6k4m8,項目名稱:neuroglancer,代碼行數:14,代碼來源:texture.ts

示例3: setTextureData

 setTextureData(gl: GL) {
   let {data} = this;
   let {chunkFormat} = this;
   let textureLayout = this.textureLayout =
       chunkFormat.getTextureLayout(gl, this.chunkDataSize, data.length);
   let requiredSize = textureLayout.textureWidth * textureLayout.textureHeight;
   let padded = maybePadArray(data, requiredSize);
   gl.texImage2D(
       gl.TEXTURE_2D,
       /*level=*/0, gl.RGBA,
       /*width=*/textureLayout.textureWidth,
       /*height=*/textureLayout.textureHeight,
       /*border=*/0, gl.RGBA, gl.UNSIGNED_BYTE,
       new Uint8Array(padded.buffer, padded.byteOffset, padded.byteLength));
 }
開發者ID:j6k4m8,項目名稱:neuroglancer,代碼行數:15,代碼來源:chunk_format.ts


注:本文中的neuroglancer/webgl/context.GL.texImage2D方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。