New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension to clipping #1420
Comments
I don't think it would be easy or practical to support arbitrary clipping shapes, the clipping rectangle is processed both on CPU side and GPU side (typically using the Scissor functionality of GPU driver which is essentially axis-aligned clipping), and imgui typically rely on a single shader to batch draw calls. Also if you clipped the polygons on CPU side it will be harder to get nice anti-aliasing on those shapes. Really, for your example and many other uses cases it would be much much easier to just generate the right shape/polygons in the first place. So you can perform all the polygon manipulation and clipping on your side and then submit that as convex shapes to ImDrawList. But the complexity of that code depends on what you ACTUALLY need to render. Here you are showing a rotated half circle and if that's what you really want to draw, that's very easy to do. In fact you can already do it with 2 function calls:
Done! |
Wish it was that simple in my case. Think of the red part as a 'breathing' UI, it constantly clips out some region from its bottom-right to hide/show information, so it's not only the background UI. I think what I'm asking is way too much from ImGui though, supporting something like this natively would be redundant. I'll detach this portion of the application from ImGui and just use shaders/post-processing to get what I want. Thanks for your input. You can close the issue if you wish. :) |
Hello once again. I was looking into
PushClipRect()
andPopClipRect()
and needed some extra functionality for what I'm trying to do. Let me explain it as fast as I can.I have a circle for my background and sometimes I only want a certain region of it rendered. For example, I want to clip-out the black colored area:
With the current rectangular clip I can only achieve it linearly, like so:
This may sound like the world's most unnecessary feature request, and it probably is. Adding a function like
PushClipRectEx
which would make it possible to define all 4 corners of the rectangle or maybe a trapezoid clip area should solve this issue. I've just started messing around withImDrawList
but I'll take a crack at it anyway after my mid-terms. Let me know of your thoughts.The text was updated successfully, but these errors were encountered: