Jump to content
  • Advertisement
Sign in to follow this  
Daedulus

Stencil Preformance

This topic is 5123 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!