Reputation:
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?
Upvotes: 5
Views: 1759
Reputation: 12184
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.
Upvotes: 0
Reputation: 52549
Draw a white line and use glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
Don't forget to enable GL_BLEND
Upvotes: 6