1

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

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.

Christian Rau
  • 45,360
  • 10
  • 108
  • 185
Yury
  • 3,000
  • 2
  • 24
  • 24

1 Answers1

6

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.

Dietrich Epp
  • 205,541
  • 37
  • 345
  • 415
  • Works great, thanks a lot! The only thing is that I've used GL_ARB_framebuffer_sRGB, which seems to be identical, but more recent (2008 against 2006). – Yury Oct 11 '11 at 04:32