Texture

constructor(width: Int, height: Int, format: Int, type: Int, isRT: Boolean = false, internalFormat: Int = format, target: Int = GL_TEXTURE_2D)

Parameters

format

pixel format passed to glTexImage2D (e.g. GL_RGBA, GL_DEPTH_COMPONENT).

type

pixel type passed to glTexImage2D (e.g. GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT).

internalFormat

internalformat passed to glTexImage2D. Defaults to format (unsized), which is the only legal value on WebGL1 / GLES2. Pass a sized internal format (e.g. GL_RGBA8, GL_DEPTH_COMPONENT16) only when Kgl.supportsSizedTextureFormats is true. Required for MSAA blit-resolve compatibility — the resolve target's internal format must literally match the multisample renderbuffer's (GL_RGBA8).

target

texture target. Defaults to GL_TEXTURE_2D. Pass GL_TEXTURE_CUBE_MAP for cube-map storage; the constructor will allocate all six face images.