Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The WebGLRenderingContext.unpackColorSpace
property specifies the color space to convert to when importing textures. Along with the default (srgb
), the display-p3
color space can be used.
Texture image sources can be the following:
ImageBitmap
ImageData
HTMLImageElement
HTMLCanvasElement
HTMLVideoElement
OffscreenCanvas
VideoFrame
Textures are imported using the WebGLRenderingContext.texImage2D()
and WebGLRenderingContext.texSubImage2D()
methods and conversion to the specified unpackColorSpace
color space happens during import.
Note that this doesn't apply to HTMLImageElement
when the UNPACK_COLORSPACE_CONVERSION_WEBGL
pixel storage parameter is set to NONE
.