I am having trouble utilizing sRGB textures with WebGL2. I am attempting to load a texture and display it as a fullscreen quad, but the image is displaying incorrectly (too dark.)
The texture loading code is the following.
const texture0 = await (() => {
const image = new Image()
const promise = new Promise(resolve => image.onload = () => {
const texture = gl.createTexture()
gl.bindTexture(gl.TEXTURE_2D, texture)
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.SRGB8_ALPHA8, 256, 256)
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 256, 256, gl.RGBA, gl.UNSIGNED_BYTE, image)
resolve(texture)
})
image.src = "./images/texture.png"
return promise
})()
I'm thinking maybe it has to do with the encoding of the framebuffer, but I do not see an equivalent to glEnable(GL_FRAMEBUFFER_SRGB)
in WebGL.