PDA

View Full Version : Antialiased lines with correct destination alpha



surfdabbler
03-11-2010, 01:01 AM
I'm rendering in to a texture. I have some background colours, and the drawing some antialiased lines over the top. Problem is, when I draw the antialiased line, the pixels that are blended end up blending the alpha channel as well.

Ideally, I need to somehow seperate the blending of the alpha channel, so the colours can be blended using

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

But the alpha channel needs

glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);

Is there away to do this?

Alternatively, I would settile for some way to disable writing to the alpha channel temporarily, so it can just remain at the original block-colour alpha, but that's not ideal - eventually, I might like to have antialiased lines drawn over transparent sections of the texture.

Any thoughts?

ZbuffeR
03-11-2010, 02:04 AM
Something like blend_func_separate ?
http://www.opengl.org/registry/specs/EXT/blend_func_separate.txt

surfdabbler
03-11-2010, 04:33 PM
Aha! Perfect, thank you very much. It works great now!