Function glTexSubImage2D

  • Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled.

    glTexSubImage2D redefines a contiguous subregion of an existing two-dimensional or one-dimensional array texture image. The texels referenced by data replace the portion of the existing texture array with x indices xoffset and xoffset + width − 1, inclusive, and y indices yoffset and yoffset + height − 1, inclusive. This region may not include any texels outside the range of the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect.

    If a non-zero named buffer object is bound to the GL_PIXEL_UNPACK_BUFFER target (see glBindBuffer) while a texture image is specified, data is treated as a byte offset into the buffer object's data store.

    Parameters

    • target: number

      Specifies the target texture. Must be GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, or GL_TEXTURE_1D_ARRAY.

    • level: number

      Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nᵗʰ mipmap reduction image.

    • xoffset: number

      Specifies a texel offset in the x direction within the texture array.

    • yoffset: number

      Specifies a texel offset in the y direction within the texture array.

    • width: number

      Specifies the width of the texture subimage.

    • height: number

      Specifies the height of the texture subimage.

    • format: number

      Specifies the format of the pixel data. The following symbolic values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, and GL_BGRA.

    • type: number

      Specifies the data type of the pixel data. The following symbolic values are accepted: GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, and GL_UNSIGNED_INT_2_10_10_10_REV.

    • data: void

      Specifies a pointer to the image data in memory.

    Returns void

    Summary

    specify a two-dimensional texture subimage

    Tutorial

    Songho - OpenGL Pixel Buffer Object (PBO)

    See

    glTexSubImage2D

Generated using TypeDoc