HW acceleration and non-rectangular windows (Win32)

I need to render a humanoid model in a non-rectangular Win32 window set with the SetWindowRgn API. Unfortunately, I have to render to an offscreen bitmap in order to get a decent result, thus disabling hardware acceleration on consumer-level cards (using a double-buffered window with HW rendering enabled produces annoying artifacts and a quite lower rendering speed). It seems to be worse using the Layered windows functions on Windows 2000 (horrid flickering effects).
Does anyone know if it is nevertheless possible to use non-rectangular windows and HW rendering and still get acceptable results one way or another (especially with Windows 2000) ?

I am trying to do the same thing. I have not discovered how to do it yet, but when I do I will forward what I discover to you. Please let me know if you have found out how to do it.

I have thought of just rendering to a bitmap and then displaying the bitmap in the window. This should work but I think it might be kind of slow.

You could use the stencil buffer to mask the part of the window (the rectangular one, coz’ you must have one somewhere !) you do not want to render to… Of course, this is good only if you have HW support for stencil buffer !

Well, just an idea…

Regards.

Eric

Thanks for the response. I have been trying to use the stencil buffer, but it doesn’t seem to work. I have a mask in a 2D array how do I use this mask in the stencil buffer.

Actually, you do not want your mask in an array: you want it as a polygon, or a set of polygons.


(---- The guy is thinking ! ----)


OK, here is what we are going to do: send me an e-mail and I will reply with an example (I have never done that type of stuff so I prefer coding it rather than telling you how to do it the wrong way !).

Regards.

Eric

OK, the example has just been e-mailed…

I do not use GDI to draw the borders though (no time at the moment). And the example uses GLUT but you can adapt it to whatever you like…

Please tell me if you want it to be developed further…

Regards.

Eric

P.S.: forgot to tell you: use the left mouse button to rotate the cube and the middle one to zoom on it… (you do not have a middle button ??? Well, you will have to modify the source ! Do not forget to disconnect the menu…)