Stencil Preformance

Started by
5 comments, last by Daedulus 19 years, 4 months ago
So I was hacking my way through Lesson 26 and everything is wokring fine except the preformance is horrible. As soon as I disable the stencil buffer, though, it works fine. I double checked everything, I'm running in 32-bit mode with a res of 1280x1024, a depth buffer of 16 and stencil buffer of 8. I've cleared the stencil buffer in both InitGL () and DrawGLScene. I replicated these settings using the demo code, and it runs fine. I've got a 1.7ghz P4 with a GeForce 2.
Advertisement
You need a 24 bits depth buffer. With only 16 bits you'll get stencil buffer emulation in software, hence why it's slow.

Y.
Still nothing...
If you're running in a window, that might be it. On a GF2 I owned, whenever the stencil buffer was used in a windowed application, it was incredibly slow. When I switched to fullscreen, it suddenly ran at proper speeds.
No luck there either, it's always run fullscreen. Thanks though.
I haven't ever had any performance hit using the stencil buffer. I may be wrong, but depending on the application, I think you could do a 1 bit stencil buffer. I only use it for shadows. I use a matrix to flatten the shadows to the plane, then draw the objects normal, the only difference is that I make the plane 0.1 above the original plane, I can't tell the defference and using the stencil buffer, you still draw only where the plane is. For this, I only use a 1 bit stencil buffer because it is only a yes-no whether to draw this pixel or not. I don't count the repeats or anything like that so I don't think anything larger is needed.


Yeah, I'm using it it to do reflections (from Nehe tutorial 26). I originaly had the stencil buffer set to 1, but then I was searching for a fix to my problem from previous threads and in one(forget which) and someone said to increase the stencil buffer to 8. That obviously didn't help, but whatever. Thanks anyway.

This topic is closed to new replies.

Advertisement