tags:

views:

162

answers:

3

i want my lines to be drawn with negative color (taken from the screen under the line), i just didnt understand how the blending works, looked at docs etc, tested 50 combinations and so on. started to think its not possible at all...

could someone just give the two values, im tired of thinking how it works.

thanks,

+3  A: 

Draw a white line and use glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); Don't forget to enable GL_BLEND

Andreas Brinck
+1  A: 

You should use logic ops for that purpose. Not blend. So all you have to do is to call:

glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_INVERT);

You can use GL_ XOR too, depending what you want to achieve. GL_ XOR is useful if you want to restore the frame buffer exactly in the state that it was before the line draw happened. Just draw a second time the same line with GL_XOR again ((a xor b) xor b == a). It's a common trick in CAD world.

Stringer Bell
A: 

OpenGL glBlendFunc tools that I have found particularly useful for beginners

gabriev82