Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

jeppa

Carmack's reversed Problem

This topic is 6007 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

I have a problem with "Carmack''s reversed" Stencil Shadow.Is It correct way??? code: //Set Stencil buffer // glDepthMask(GL_FALSE); glEnable(GL_STENCIL_TEST); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glStencilFunc(GL_ALWAYS,0,0xFFFFFFFFL); //**********************// glStencilOp(GL_KEEP,GL_INCR,GL_KEEP); glCullFace(GL_FRONT); drawShadowVolume(); //**********************// glStencilOp(GL_KEEP,GL_DECR,GL_KEEP); glCullFace(GL_BACK); drawShadowVolume(); //***********Draw panel*************// glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); glColor4f(0.0f,0.0f,0.0f,0.5f); glEnable( GL_BLEND ); glDisable(GL_CULL_FACE); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glStencilFunc( GL_NOTEQUAL, 0, 0xFFFFFFFFL); glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP ); Thanks in Advance;

Share this post


Link to post
Share on other sites
Advertisement
Try adding glDepthFunc(GL_LEQUAL); after your first call to glStencilFunc. Youll also want to draw a quad over the screen, set to only draw on shadowed regions (set by stencil).

-----------------------
chain=chain->chain;

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!