当前位置: 首页>>代码示例>>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;未经允许,请勿转载。