Hi
I realise the answer might be / probably isn’t to use glscissor but I didn’t know how to describe the problem differently.
I’d like to be able to do the following in a UI I am building
- Have a scroll pane
- Have the scroll pane contain a 2d ui element such as a tree, data is stored / rendered in a scene based structure (parent objects with children)
- The tree effectively has a set of labels drawn with icons to control the opening and closing of nested elements
- When opening the tree up it is larger than the scroll pane so shouldn’t be drawn outside of the scroll pane
- Each label is a fixed size and the text (basically a texture), shouldn’t be drawn outside of its bounds too
If I use glScissor on the scroll pane every thing works ok, if I nest the glscissor’s so that the scroll pane and the labels both use glscissor I get in to issues. If I scissor the labels and then restore the scissor for the scroll pane for other drawing, I lose the scroll panes scissor during the label draw so labels can get drawn outside the scroll pane (either overlapping or completely outside).
So my question is are there better ways to do this clipping or more clever ways to use glScissor? I have read that some people use the stencil buffer, but I am unsure of the design principals of stencils (having never used them( to know whether it would solve this problem or not).