Sign in to follow this  

Best way to clip non-rectangular regions?

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. 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
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 );

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this