Archived

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

Noob question, depth vs stencil buffer

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

The problem I am haivng is deciding which method I should use to cut a hole in a polygon to make a donut shape. I was wondering if I should use the depth buffer by drawing the "hole" first, than draw the polygon around the hole. I would draw the hole using glDrawBuffer(GL_NONE), than I turn use glDrawbuffer(GL_BACK) than draw the polygon. I like that technique, but i was wondering if I can do the same thing BETTER or more effecienty with the stencil buffer. Thanks [edited by - dr_slash_uh on March 24, 2004 7:54:48 PM]

Share this post


Link to post
Share on other sites
Use the stencil buffer of course. Draw the hole as 1s in the stencil buffer and then draw the poly only where stencil test passes (!=1).



"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites
See what I am trying to do is make a doom type game with opengl. the problem I was having was making donut shaped sectors. What I originally though of doing was "ACTUALY" cutting a hole in a sector, basically breaking up 1 polygon into many polygons with a hole in it. So I just decided the easier thing to do would be to just simulate a whole by using one of the buffer techniques. I am going to look into the stencil buffer method.

Thanks luke and poppet.

Share this post


Link to post
Share on other sites