Thank you for taking the time to respond, I appreciate it, although the solution might require a little more effort.
a) - You could simply only draw what should be seen, like only half of the circle. That would avoid needless work that gets cut anyway.
b) - You can ignore what would be outside the screen as it would get cut away anyway(or if easier just not draw part of it).
c) - You can use the scissor test if you have a rectangular area where you draw in like with the circle.
d) - You could use the depth buffer for if you for example would draw the half circle first and later the rectangle a bit behind it and avoid overdraw there.
e) - You can use the stencil buffer, but you need to have one at first and then set some config for it and set it to the needed pattern when needed for each item (like deactivating the test before the triangle), which is more complicated than the other choices.
f) In the end its probably best to go the easiest way for you first and only optimize if there really is a problem with performance.
a: That would be great. I better make a draw call to the entire circle, though. But I like the way you see the problem, though.
b: The screen? Yes. A rectangular shape with n-levels of transforms (S,R,T)? No. I cannot ignore it entirely. Hence, my original post.
c: That's a good suggestion. I actually hadn't used glScissor() until today, as I never tried to pull this sort of thing off before. It seems it's bound to the viewport, though.
I'd really need a way to do glScissor() while using the gl transform stack. (Some unknown grandchildren can be transformed, and they might need to use glScissor() too...)
d: Using the depth buffer is actually a really good idea. I think I might end up using that. It's just a shame because i thought the stencil buffer could pull off what i need.
I need overdraw on all of the elements, though. I have no idea what elements have transcluency and which ones that don't. :-(
e: I think I should get back to this once before deciding on the depth buffer approach.
f: I fully agree! Thanks for all your input, it's much appreciated!
Why don't you just set the scissort test to match your parent x,y,width,and height. then anything that falls outside that bound will not be drawned.
I think I might have worded my question wrong, but there's no set tree or set amount of elements or levels. If the circle had its own child element,
a pentagon which is placed in the far right side of the circle. (outside the bounds of the blue rectangle), this approach would cause the pentagon to be rendered.
(Only because glScissor() is not inherited through the gl transform stack as it seems [please tell me if this isn't correct]) On the top of that, I don't think glScissor() can be transformed at all.
But for this specific problem, your approach would work.