Bad (unattractive) blending in OpenGL with bright figures on dark background
I h开发者_如何学JAVAave 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.
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.
精彩评论