坏(不具吸引力)混合在OpenGL与在黑暗的背景明亮的人物 [英] Bad (unattractive) blending in OpenGL with bright figures on dark background

查看:185
本文介绍了坏(不具吸引力)混合在OpenGL与在黑暗的背景明亮的人物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OpenGL的一个问题混合(抗锯齿或纹理绘画的结果)。见问题说明:

I have a problems in OpenGL with blending (in result of antialiasing or textured painting). See problem illustration:

我有以下设置code

I have the following setup code

// Antialiasing
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
// Blending
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
// Texture font
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

请,点我对这个问题的解决方案。

Please, point me to the solution of this problem.

推荐答案

OpenGL的混合线性RGB色彩空间,但是你的显示器是不是线性的。这会导致明显的阿尔法根据背景是明或是暗改变。尝试使用 GL_EXT_framebuffer_sRGB 扩展。

OpenGL blends in a linear RGB color space, but your monitor is not linear. This causes the apparent alpha to change depending on whether the background is light or dark. Try using the GL_EXT_framebuffer_sRGB extension.

这篇关于坏(不具吸引力)混合在OpenGL与在黑暗的背景明亮的人物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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