mpen
mpen

Reputation: 283053

Is there a blend mode for drawing "visible" lines?

I'm making a paint-like program. I want to allow users to draw rectangles (selections). Presently, I'm painting the rectangle using white lines. However, if they try drawing one over top a white image, the line won't be visible.

Other programs get around this by using "marching ants" or by using a sort of inverted color so that the line is always visible.

What's the easiest way to achieve this effect in OpenGL?

If relevant, I'm using C# w/ OpenTK + WinForms.

Upvotes: 2

Views: 405

Answers (2)

datenwolf
datenwolf

Reputation: 162309

OpenGL can do this, too. Look at the various logic operations offered by OpenGL. Using the XOR logic operation, you'll get a nicely contrasting line.

OpenGL glLogicOp reference

Upvotes: 3

Ben Voigt
Ben Voigt

Reputation: 283733

You could draw two rectangles, with colors opposite each other, offset by one pixel from each other. Or you could just use the color they're drawing with (WYSIWYG-style). Drawing a white rectangle atop a white image won't change the image, so why should feedback suggest that it does?

Upvotes: 1

Related Questions