I read articles about circumcision for hours now, but I didn't seem to find a solution to my problem.
This is my scenario:
In the OpenGL ES environment (IOS, Android), I have a 2D scene graph consisting of paintable objects that make up a tree.
Each node tree has its own space with its own transformation matrix, and each node inherits its coordinate space from its children. Each node has a rectangular bounding box, but these bounding fields are not aligned along the axes.
This setting is great for rendering a 2D scene graph, iterating over a tree, rendering each object, and then its children.
Now my problem arises: I'm looking for a way to crop a node. If the clipping function is enabled, children from the node must be cropped when leaving the area of ββthe parent bounding box.
For example, I want a node to contain a set of text nodes in the form of child elements that can be scrolled up and down, restricting the frame of parental constraints, and should be cropped when leaving the area of ββthe parent bounding box.
Since the bounding fields are not aligned along the axis, I cannot use glScissor, which would be the easiest way.
I thought about using a stencil buffer and drew a filled bounding box into it when clipping is turned on and then the stencil buffer is turned on. This may work, but leads to another problem: what happens if the child inside the clipped node is clipped again? - The stencil mask should be set for the child by erasing the stencil mask of the parents.
Another solution that I was thinking about is to do a clipping in the software. This would be possible, because in each node, clipping could be done relatively easily in its own local coordinate space. The backdraw of this solution will be that clipping must be implemented for each new node type that is implemented.
Can someone here point me in the right direction? What I'm looking for is something like glscissor functionality for clipping rectangular areas that are not oriented along the axis.