Jump to content
  • Advertisement
Sign in to follow this  
c4am95

OpenGL Drawing polygons w/ stencil buffer

This topic is 3435 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've been hearing a lot about using the stencil buffer with an even-odd rule to draw polygons. Yet everywhere I go I only find explanations of it in OpenGL. Can someone help me get this done in directx 10 or point me in the direction of a good tutorial or something? Also, I'm wondering how much better this would perform over simply triangulating the polygons before rendering. To my understanding, this technique requires a lot of state changes. So in a scene with hundreds of thousands of different polygons with hundreds of different textures, if you're rendering on a per-polygon basis...it seems like it would perform horribly. Any thoughts?

Share this post


Link to post
Share on other sites
Advertisement
I'm not familiar with this particular algorithm, and you failed to provide any reference or explanation, which certainly doesn't help people help you.

Regarding DirectX vs OpenGL, stencilling isn't that different between them, so if you're familiar with D3D you should be able to translate the calls easily.

Share this post


Link to post
Share on other sites
http://glprogramming.com/red/chapter14.html#name13

"Drawing Filled, Concave Polygons Using the Stencil Buffer"

thanks for your help.

Share this post


Link to post
Share on other sites
http://stackoverflow.com/questions/91202/is-there-an-efficient-easy-way-to-draw-a-concave-polygon-in-direct3d

so if you look at either of these posts, they describe a two-pass rendering method. in the first pass, you write only to the stencil buffer on draw commands. in the second pass, you disable writing to the stencil buffer and draw to the depth and color buffers.

i don't really understand how to control all the buffer access, e.g. how to disable writing to the color buffer in the first pass. i have some sad buffers, and i don't know how to soothe them.

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!