Rendering into non-rectangular windows

I am trying to render into a non-rectangular window that I created using the SetWindowRgn() in Visual C++. The problem is that OpenGL seems to ignore the active region of the window amd when I render into it OpenGL overwrites all the cool graphics I have around the active area. Help!!

There are a few different things you might want to try to stop this behavior (or really just mask it). I’ve never tried to draw into a non-rectangular region so these ideas may not work at all. I know none will work universally. First idea is to put a mask of the region in an alpha buffer and use alpha testing to reject pixels outside the region. Or you could instead use the stencil buffer and use a stencil test to reject pixels outside the region. Finally, the other method is to use clip planes, but unless your region is fairly simple, I doubt there would be enough clip planes available to fully enclose the region. The alpha buffer solution’s problem is that many cards don’t support alpha buffers at all, or do, but only in 32 bpp mode. Stencil buffer has the same problem. And if OpenGL has to fallback to software to emulate those features, your program will be about as fast as molasses on a cold morning.

[This message has been edited by DFrey (edited 02-07-2001).]