Reputation: 283053
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
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.
Upvotes: 3
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