I would like to draw a polygon over an environment and then I would be able to see the scene just through a hole in this polygon. For exemple:
****************** ******************
| || || || | + **** **** = ****| || ****
| || || || | ** ** **| || || || **
**** **** **** ****
****************** ******************
scene cloudy polygon we just can see
with a hole part of the scene
The polygon should be a QUAD and the hole a circunference.
Is there any way to subtract shapes? I mean, take a quad and subtract a circle… than the problem would be over.
If you want the subtraction, the hole in the polygon, to be static, then the best solution is, to build the whole thing including the hole, out of triangles.
If it’s supposed to be dynamic (the position of the hole in the quad changes), you have 2 possibilities:
compute the geometry of the polygon with the hole at the current position for every frame
use the stencil buffer (draw the circle into the stencil buffer, then draw the quad everywhere where the stencil buffer is empty)
Sounds like shooting holes… Maybe use a 1 alpha bit texture (ie: transparent of not)? That wouldn’t be very fast though (since you don’t know which faces are behind it and would have to draw all). Maybe add little portals… Okay, sounds slow as well.