The texture format that is used in qopenxrgraphics_opengl.cpp for OpenGL swapchain is GL_RGBA8, but Qt Quick 3D renders its contents with tone mapping by default, so we need to request GL_SRGB8_ALPHA8_EXT instead.
// List of supported color swapchain formats.
constexpr int64_t supportedColorSwapchainFormats[] = {
GL_RGBA8,
GL_RGBA8_SNORM
};
As a temporary solution to get correct colors tonemapping can be disabled:
XrView { environment: SceneEnvironment { tonemapMode: SceneEnvironment.TonemapModeNone } }
I think the truly correct fix would be to select a linear texture format (GL_RGBA8) if tonemapping is off and select SRGB format (GL_SRGB8_ALPHA8) if tonemapping is enabled.
Interestingly, SRGB format is already used in qopenxrgraphics_opengles.cpp, but it seems desktop OpenGL didn't receive the same amount of love
For Gerrit Dashboard: QTBUG-141224 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
684834,1 | XR: OpenXR: OpenGL: use as SRGB texture format for swapchain | dev | qt/qtquick3d | Status: NEW | 0 | 0 |