I think my current code supports siblings correctly.
It's the
glScissor(scissor[0],scissor[1], scissor[2],scissor[3]);
part at the end of the Render function that should garuantee for this.
Basicly, each node ensures that it the scissor and translations get restored at the end of it's rendering function.
I've tried to work it out several times, but I can't seem to get it right...
Must be my brains shutting down after trying to design a system for school which by it's very definition and idea on how it should work resists all logic.:P
I got this:
0x0x800x600
red:
0.1x0.1x0.5x0.5
80x60x400x300
80x60x400x300
green:
0.1x0.1x0.5x0.5
80x60x400x300
160x120x400x300
blue:
-0.15x-0.15x0.5x0.5
-120x-90x400x300
160x120x400x300
An explanation, the first line of each node is the floating point notation.
The second one are the resulting values for the offset to point 0x0 (or the parents offset point).
The third line is the result of the "stack".
Something else that I've just tried, I tried outputting the result of this part:
// Make the scissor size always smaller
/* This means that the X and Y values can only get bigger
* And that the W and H values can only get smaller*/
glScissor((scissor[0] > nX ? scissor[0] : nX),
(scissor[1] > nYtoUse ? scissor[1] : nYtoUse),
(scissor[2] < nW ? scissor[2] : nW),
(scissor[3] < nH ? scissor[3] : nH));
The result was:
scissor1:80:240:400:300
scissor2:1:0:800:600
scissor1:160:240:400:300
scissor2:1:240:400:300
scissor1:160:240:400:300
scissor2:1:240:400:300
Which would suggest an error in my logic.
Or a flaw in my programming, since the line which outputs the scissor1 part is:
std::cout<<"scissor1:"<<(scissor[0] > nX ? scissor[0] : nX)<<":"<<
(scissor[1] > nYtoUse ? scissor[1] : nYtoUse)<<":"<<
(scissor[2] < nW ? scissor[2] : nW)<<":"<<
(scissor[3] < nH ? scissor[3] : nH)<<std::endl;