Usually, one would want to upload texture data to OpenGL with GL_SRGB*
for the internalformat
of a texture, and GL_RGB*
(or some other linear format) for normal data or specular highlight maps. We can minimize context switches by using a texture array, but that forces all textures to have the same internalformat
. Is there a way to store all needed textures in a single texture array, but preserve colour spaces? Or should I convert from SRGB to linear space when uploading texture data?
\$\begingroup\$
\$\endgroup\$
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
2
I think the only way to achieve this is by building a texture array and then using a view into the array, casting into a different internalformat
.
-
\$\begingroup\$ How is that any better than just using separate textures for sRGB and linear data? You need to bind the view texture to a separate TIU, so you're not saving anything there. While the original and view share the same data, each one will only be used to access an exclusive subset of it. All I see this doing is requiring support for GL 4.3 and requiring that the diffuse map shares the same resolution as the normal/specular/etc maps (eliminating a possible performance improvement on low-powered systems). \$\endgroup\$– bcristCommented Jan 6, 2015 at 5:57
-
\$\begingroup\$ @bcrist Yes, it's not any better - it's a disappointing result :) \$\endgroup\$– ocharlesCommented Jan 6, 2015 at 10:17