OpenGL - 在 GIMP 中创建的 RGB 与 SRGB 纹理

发布于 2025-01-10 22:36:06 字数 567 浏览 5 评论 0原文

GIMP 默认使用 sRGB 色彩空间。我使用 GIMP 创建了两个简单的 png 纹理。纹理包含单一 RGB 颜色 [0, 0, 128]。第一个纹理已导出,但没有“保存伽玛”选项,第二个纹理带有“保存伽玛”选项。在我的 OpenGL 应用程序中,我使用以下参数加载纹理:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, img.getWidth(), img.getHeight(), 0, GL_BGR, GL_UNSIGNED_BYTE, img.accessPixels());

如您所见,我不使用 sRGB 作为纹理内部格式。然后我以这种方式读取纹理:

glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);

B 分量包含相同的值 - 两个纹理均为 128。对于没有“保存伽玛”选项导出的纹理,我期望获得等于 128 的 B 分量,并且由于伽玛曲线,对于使用“保存伽玛”选项导出的纹理,B 分量大于 128。我的假设正确吗?也许 Gimp 并不像我想象的那样导出纹理。

GIMP by default uses sRGB color space. I have created a two simple png textures using GIMP. The textures contain a single RGB color [0, 0, 128]. The first texture has been exported without the "save gamma" option, the second with the "save gamma" option. In my OpenGL application I load the textures using the following parameters:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, img.getWidth(), img.getHeight(), 0, GL_BGR, GL_UNSIGNED_BYTE, img.accessPixels());

As you can see I don't use sRGB as a texture internal format. Then I read a texture this way:

glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);

B component contains the same value - 128 for both textures. I expected to get B component which is equal 128 for the texture exported without the "save gamma" option and B component greater than 128 for the texture exported with "save gamma" option due to gamma curve. Are my assumption correct ? Maybe the Gimp doesn't export the textures as I assumed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

椵侞 2025-01-17 22:36:06

当我在 GIMP 中创建纹理时,我从 sRGB 调色板中选择一种颜色。颜色 [0,0,128] 的可见表示已在 sRGB 颜色空间中定义。 “保存伽玛”选项仅添加元数据信息。

When I create a texture in GIMP I choose a color from the sRGB palette. The visible representation of the color [0,0,128] is already defined in sRGB color space. The "save gamma" option only adds metadata info.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文