Bad (unattractive) blending in OpenGL with bright figures on dark background

我怕爱的太早我们不能终老 提交于 2019-12-24 07:14:46

问题


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

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.


回答1:


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.



来源:https://stackoverflow.com/questions/7711022/bad-unattractive-blending-in-opengl-with-bright-figures-on-dark-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!