PDA

View Full Version : Partial screen transparency



lcmiguez
02-09-2006, 11:52 AM
I need to know how can I draw a screen with a transparent polygon hole in its middle, where I can see the previous scene that was drawn beforehand.

dorbie
02-09-2006, 12:01 PM
Draw the hole to stencil, when you draw the polygon add a stencil test to avoid writing to the hole.

You may want to draw the occluder to the zbuffer first if it can potentially occlude the hole and use polygon offset to draw the hole to stencil with z testing, then draw the object to the color buffer. This second more advanced approach does imply that the background is all drawn first, if you want to draw the background in any order you can stencil test a z distant polygon to the hole to clear it.

Remember to clear the stencil buffer each frame.