I would like to create a totally “invisible” object (can be a simple one, like a “gluCylinder”). The viewer would notice the object when it is behind or collide with another object - example, if a “glutSolidCube” is behind my “invisible gluCylinder”, the cube would be partially occluded by the cylinder (we would see the background on the occluded area).
How can I do that? I’ve tried to use glColorMask, so I could hide the cylinder , but the mask affected the whole frame instead of only the cylinder (maybe I’m not using it correctly, is there a way of doing it only for one (or a few) objects?). I don’t think transparency would work for me, because I’d see the occluded part of the cube, for instance.
Can you help?
Thanks in advance