Stencil-buff prob is sapping my will to live

Started by
1 comment, last by Eric 23 years, 10 months ago
I'm trying to get a 16-bit color mode that includes a stencil-buff. [update] I was enumerating incorrectly here; skip to next post [/update]. When I enumerate, I find several 16-bit color modes that have a 16-bit z-buffer, which includes 5 bits for the stencil-buff (supposedly). I'm deriving the stencil bit info from DDSURFACEDESC2 object > pixel format > dwStencilBitMask, which is '31' in all these cases. After selecting one of these modes, I call pd3dDev->Clear() and include the D3DCLEAR_STENCIL flag, and I get the "no stencil buffer" error. By the way, if I ignore this error and try to use the stencil buff, of course it doesn't work. I've tried this with a T&L device (geForce2) and the RGB device -- both claim 5 bits, and neither work. Also, note that everything works fine (i.e. my shadow-casting algo) when I have a 32-bit color mode with a 32-bit z-buffer (8 stencil bits). I also check D3DDEVICEDESC7 object > dwStencilCaps, btw. Edited by - Eric on 6/21/00 2:09:00 AM
Advertisement
Ok, I wasn't enumerating correctly before. There is a separate enumeration for z-buffer bit depth, apparently. So here is where I stand now:

- No 16-bit z-buffer w/ any stencil bits on my hardware T&L device (geForce2)
- If I attach a 32-bit z-buffer (w/ 8 stencil bits) to my 16-bit backbuffer, I am unable to SetRenderTarget() my backbuffer. Apparently this is "DDERR_CURRENTLYNOTAVAIL" on my BRAND-NEW , supposedly TOP-OF-THE-LINE geForce2 card. Actually, what matters is that this is (probably) not supported on TNT2s, which are kinda my target card. A 16-bit backbuffer w/ a 32-bit z-buffer is supported in software, btw.

Any suggestions? I just can't believe I have to use 32-bit color, which practically halves my framerate w/ almost no perceptible aesthetic improvement, just so that I can get a stencil-buff.

Edited by - Eric on June 21, 2000 3:15:46 AM
To use the stencil buffer you need to set the z-buffer to 32 bit mode (or rather 24 as the stencil buffer takes 8). Unfortunately on many cards it is required that both the color buffer and depth buffer have the same bit depth, so if you want to use 16 bit color buffer you cannot use the stencil buffer.


- WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement