XOR effect to show object selection?

Hi,

I am rendering smooth and faceted polygons in 3D. The user is able to select the polygons and I display the selection as a boundary around the polygon by adjusting the polygon mode to GL_LINE. Pretty standard stuff.

But, what I don’t have clue how to do is to render this nicely so that the selection is always visible. For example, if I use black, then selections in the shade don’t show.

So, I was thinking, how is it possible to achieve Windows GDI like effects like XOR to show the selection clearly no matter what.

Any thoughts appreciated.

Thanks

Matthew

Have you tried glLogicOp() with GL_XOR?
This is in core since 1.1. Not sure about hardware acceleration but I don’t see any reason why it should not work.

Originally posted by sqrt[-1]:
Have you tried glLogicOp() with GL_XOR?
This is in core since 1.1. Not sure about hardware acceleration but I don’t see any reason why it should not work.

As long as he doesn’t use an RGBA color buffer:

NOTES
Logical pixel operations are not applied to RGBA color buffers.

http://www.cevis.uni-bremen.de/~uwe/opengl/glLogicOp.html

Another option is to use overlay planes , if supported by his graphics board.

Thanks for taking the trouble to respond, guys. I am using RGBA. SO, I guess I’m going to have to look a little harder.

How about blinking boundaries?

Maybe you can use ADD alpha blend mode. Then the boundary are guarantee to be brighter than the rest. Just be sure to use white color, not black.

Originally posted by evanGLizr:
[b] As long as he doesn’t use an RGBA color buffer:

[quote]
NOTES
Logical pixel operations are not applied to RGBA color buffers.

[/b][/QUOTE]

True. …for OpenGL 1.0

Logical Operation
glEnable(GL_COLOR_LOGIC_OP);

Still, the result of a xor isn’t always visible. Changing colors are.

To ensure that your selection colour stands out, you could always just render a width 3 line in “say grey”, or perphaps semi opaque black, with a dashed width 1 line in “say white” on top. That way you’ll at least be guaranteed some contrast.

Hope this helps,

Heath.

[This message has been edited by heath (edited 07-17-2003).]

Originally posted by Serge K:
[b] True. …for OpenGL 1.0

Logical Operation
glEnable(GL_COLOR_LOGIC_OP);[/b]

Ooops, looks like you are right :stuck_out_tongue:

The logical operation on color values is enabled or disabled with Enable or
Disable using the symbolic constant COLOR LOGIC OP. If the logical operation is
enabled for color values, it is as if blending were disabled, regardless of the value of BLEND.

OpenGL 1.4 spec

Thanks Heath, I like simple solutions. That may do nicely.

Matthew