Drawing masked sprites (textured quad with alpha channel)

Hi, i would like to know how to draw a sprite (rendered using a textured quad) on the screen in such a way that some parts of it are not rendered at all (masked).

For example, suppose i have a wall with a window at its center. The window is open and i want to render a sprite inside the window. Suppose that the sprite is animated: the character is walking from left to right. I want to appear behind the window gradually.

The easy way is to use glScissor. Even if the window is not perfectly rectangular, i can use, for glScissor, a slightly bigger rectangle.

But what i i want to use a non rectangular mask (and even a non polygonal but complex mask)?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.