OpenGL ES 3.0上的sRGB帧缓冲区 [英] sRGB Framebuffer on OpenGL ES 3.0

查看:602
本文介绍了OpenGL ES 3.0上的sRGB帧缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java进行OpenGL ES 3.0 Android项目. 我需要实现伽玛校正,并且在某处我已经了解到OpenGL ES 3.0将支持sRGB纹理.因此,我的意图是在渲染到默认帧缓冲区之前调用glEnable(GL_FRAMEBUFFER_SRGB).

I am working on a OpenGL ES 3.0 Android project using Java. I need to implement gamma correction and somewhere I've read that sRGB textures would be supported in OpenGL ES 3.0. So my intention was to call glEnable(GL_FRAMEBUFFER_SRGB) before rendering into the default framebuffer.

但是,当我尝试致电

GLES30.glEnable(GLES30.GL_FRAMEBUFFER_SRGB)

事实证明,没有GLES30.GL_FRAMEBUFFER_SRGB,但是有一些sRGB纹理格式的常量,例如GLES30.GL_SRGB.

it turns out, there is no GLES30.GL_FRAMEBUFFER_SRGB, but there are some constants for sRGB texture formats like GLES30.GL_SRGB.

所以,我的问题是:是否可以让OpenGL ES 3.0对我进行伽玛校正?如果是,怎么办?

So, my question is: is it possible to let OpenGL ES 3.0 do the gamma correction for me? If yes, how?

否则,我想我将不得不手动进行伽玛校正.

Otherwise, I guess, I'll have to do gamma correction manually.

推荐答案

我意识到这个问题已经2个月了,但是由于它出现在Google上,我想我会为将来的Google员工发布答案了:)

I realize that this question is 2 months old, but since it came up in Google, I guess I would post an answer for future googlers :)

GL_FRAMEBUFFER_SRGB似乎仅在OpenGL桌面以及通过OpenGLES 2.0的扩展中可用.但是通过实验(我目前正在研究该主题),我意识到在OpenGLES 3.x上,只要帧缓冲区下面的纹理具有sRGB格式,在写入帧缓冲区时,颜色就会正确地(自动)转换为sRGB. .因此,在渲染为sRGB纹理时,无需使用GL_FRAMEBUFFER_SRGB来启用sRGB转换.

GL_FRAMEBUFFER_SRGB seems to only be available on OpenGL desktop, and through extensions on OpenGLES 2.0. But through experimentations (I'm currently working on this subject) I realized that on OpenGLES 3.x, whenever the texture underlying a frame buffer has an sRGB format, colors are correctly (and automatically) converted to sRGB when writing to the frame buffer. So you don't need to use GL_FRAMEBUFFER_SRGB to enable sRGB conversion when rendering to an sRGB texture.

现在,如果直接写入后台缓冲区,则可能具有启用sRGB写入的选项,但是可以在应用程序端进行控制(例如,在Windows上,如果我通过wgl创建上下文,则可以指定该标志) (不要误会)不幸的是,我无法确认这一点,因为在我正在研究的框架中,我无权访问此部分.

Now if you write directly to the back buffer, you might have options to enable sRGB writes, but that would be controlled on the application side (for instance on Windows it's a flag that you specify when creating your context through wgl if I'm not mistaken) Unfortunately I can't confirm this since in the framework I'm working on, I don't have access to this part.

这篇关于OpenGL ES 3.0上的sRGB帧缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆