GetDeviceGammaRamp 调整颜色

发布于 2024-09-01 17:10:27 字数 403 浏览 4 评论 0原文

我覆盖了一个OpenGL应用程序(c++),这个openGL应用程序使用SetDeviceGammaRamp将桌面的亮度设置为非常高(不知道为什么)。这个应用程序是全屏的,看起来不错,但我的覆盖层非常亮。由于高伽马值,我得到的不是具有正常亮度的橙色,而是黄色。

我想要做的:获取当前设置的伽玛(使用 GetDeviceGammaRamp),然后用它来调整我设置的颜色。

喜欢; glColor4f(r, g, b, a) 变为 glColor4f(r / gamma, g / gamma, b / gamma, a);

因此,如果桌面的亮度非常高,则 rg 和 b 值会更低(更暗),并且看起来应该如此。

我怎样才能做到这一点? GetDeviceGammaRamp 填充表格,如何使用它来修改我的颜色?

谢谢

I overlay an OpenGL application (c++), this openGL application uses SetDeviceGammaRamp to set the brightness of the desktop to very high (dont know why). This application is fullscreen and looks good, but my overlay is very bright. Instead of the orange color with normal brightness, I get yellow because of the high gamma.

What I want to do: Get the gamma that is currently set (using GetDeviceGammaRamp), and then use this to adjust the colors I set.

Like; glColor4f(r, g, b, a) becomes glColor4f(r / gamma, g / gamma, b / gamma, a);

So if the brightness of the desktop is very high, the r g and b values will be lower (darker) and will look like they should.

How can I accomplish this? GetDeviceGammaRamp fills a table, how can I use it to modify my colors?

Thanks

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

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

发布评论

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

评论(1

相守太难 2024-09-08 17:10:27

如果可以的话,您最好使用 ARB_framebuffer_sRGB 扩展:

#define GL_FRAMEBUFFER_SRGB 0x8DB9 //might already be defined

bool supportSRGB = (0 != strstr((char*)glGetString(GL_EXTENSIONS), "GL_ARB_texture_non_power_of_two"));
if(supportsSRGB)
{
    glEnable(GL_FRAMEBUFFER_SRGB);
}

You may be better off just using the ARB_framebuffer_sRGB extension if you can:

#define GL_FRAMEBUFFER_SRGB 0x8DB9 //might already be defined

bool supportSRGB = (0 != strstr((char*)glGetString(GL_EXTENSIONS), "GL_ARB_texture_non_power_of_two"));
if(supportsSRGB)
{
    glEnable(GL_FRAMEBUFFER_SRGB);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文