WebGLRenderingContext.drawingBufferColorSpace
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The WebGLRenderingContext.drawingBufferColorSpace
property specifies the color space of the WebGL drawing buffer. Along with the default (srgb
), the display-p3
color space can be used.
See WebGLRenderingContext.unpackColorSpace
for specifying the color space for textures.
Value
This property can have the following values:
"srgb"
selects the sRGB color space. This is the default value."display-p3"
selects the display-p3 color space.
If an invalid value is specified, then the value of drawingBufferColorSpace
will remain unchanged.
Examples
Setting the drawing buffer color space to draw a Display P3 red
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
gl.drawingBufferColorSpace = "display-p3";
gl.clearColor(1, 0, 0, 1);
gl.clear(glP3.COLOR_BUFFER_BIT);
Specifications
Specification |
---|
WebGL Specification # DOM-WebGLRenderingContext-drawingBufferColorSpace |
Browser compatibility
BCD tables only load in the browser