PDA

View Full Version : XOR effect to show object selection?



mcsellski
07-17-2003, 02:28 AM
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

sqrt[-1]
07-17-2003, 03:53 AM
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.

evanGLizr
07-17-2003, 04:42 AM
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 (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/ntopnglo_0e0o.asp) , if supported by his graphics board.

mcsellski
07-17-2003, 06:53 AM
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.

Xmas
07-17-2003, 07:24 AM
How about blinking boundaries?

paladinzzz
07-17-2003, 08:29 AM
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.

Serge K
07-17-2003, 12:14 PM
Originally posted by evanGLizr:
As long as he doesn't use an RGBA color buffer:



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



True. ...for OpenGL 1.0 http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

Logical Operation (http://www.opengl.org/developers/documentation/Specs/glspec1.1/node101.html)
glEnable(GL_COLOR_LOGIC_OP);

Xmas
07-17-2003, 01:32 PM
Still, the result of a xor isn't always visible. Changing colors are.

heath
07-17-2003, 01:47 PM
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).]

evanGLizr
07-17-2003, 02:07 PM
Originally posted by Serge K:
True. ...for OpenGL 1.0 http://www.opengl.org/discussion_boards/ubb/rolleyes.gif

Logical Operation (http://www.opengl.org/developers/documentation/Specs/glspec1.1/node101.html)
glEnable(GL_COLOR_LOGIC_OP);

Ooops, looks like you are right :p



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 (http://www.opengl.org/developers/documentation/version1_4/glspec14.pdf)

mcsellski
07-18-2003, 04:14 AM
Thanks Heath, I like simple solutions. That may do nicely.

Matthew