OpenGL - 如何检查默认帧缓冲区颜色编码
我使用 GLFW 库创建了一个 OpenGL 应用程序。默认帧缓冲区支持 SRGB: glfwWindowHint(GLFW_SRGB_CAPABLE, 1);
调用 glEnable(GL_FRAMEBUFFER_SRGB)
后,渲染测试纹理时,我在屏幕上得到了所需的结果。
出于好奇,我为默认帧缓冲区调用了glGetFramebufferAttachmentParameteriv:
GLint encoding = 0;
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &encoding);
编码变量等于GL_LINEAR(也适用于GL_FRONT_LEFT缓冲区)。 文档说:
对于默认帧缓冲区,颜色编码由 实施。
但我在窗口创建期间显式设置了 SRGB 编码,因此编码变量应等于 GL_SRGB。您能解释一下它是如何工作的吗?
I have created an OpenGL application using GLFW library. The default framebuffer supports SRGB:glfwWindowHint(GLFW_SRGB_CAPABLE, 1);
After calling glEnable(GL_FRAMEBUFFER_SRGB)
I get a desired result on the screen when render a test texture.
Out of curiosity I have called glGetFramebufferAttachmentParameteriv
for the default framebuffer:
GLint encoding = 0;
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK_LEFT, GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, &encoding);
The encoding variable equals GL_LINEAR (also for GL_FRONT_LEFT buffer). The documentation says that:
For a default framebuffer, color encoding is determined by the
implementation.
but I have set SRGB encoding explicitly during window creation so the encoding variable should be equal to GL_SRGB. Could you explain how does it work ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的系统是否支持 EXT_framebuffer_sRGB 或 ARB_framebuffer_sRGB?
您将需要它作为 sRGB 默认帧缓冲区。
Does your system support the extensions like EXT_framebuffer_sRGB or ARB_framebuffer_sRGB?
You will need this for the sRGB default framebuffer.