• Advertisement
Sign in to follow this  

Best way to clip non-rectangular regions?

This topic is 3668 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'm trying to design a clipping method for a GUI I'm developing. I need it to be able to clip window contents to a non-rectangular region AND each window must be able to have sub-windows inside that again clip their own contents while keeping all of that inside of the parent window. This thread I started a few days ago is basically how I'm going about doing it. http://www.gamedev.net/community/forums/topic.asp?topic_id=477888 But I'm finding now that this has a lot of restrictions in how I draw the windows or 'containers' and I have to change the stencil operation and comparison functions depending on what component is being drawn. Is there some other standard way of doing this without all the hassle? I've tried looking at the source code for CEGUI, FLTK, Rico's GUIDE, even Blender's source code, but they all simply use glScissor and only clip rectangular regions.

Share this post


Link to post
Share on other sites
Advertisement
looking AT your other post

i assume
setncil == 1 == the desktop, 2 == window on top of that, etc

just draw each windows region with a difference stencil value only if that stncil value is higher (thus forground windows will get drawn over other windows)

*the following is wrong since you need to look in the spec (which i cant be bothered with)

glStencilFunc(GL_LEQUAL, windowZvalue (0->255) , 0xff );
glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE);

Share this post


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

  • Advertisement