I use glScissor() in my application and it works correctly, but I ran into a problem: I have a Window object for which the drawing area is set to glScissor() and inside this area, I draw a ListView object for which the drawing area should also be specified with glScissor() , since I don't want to draw all of this.
In code, I could represent it as:
Window::draw() { glEnable(GL_SCISSOR_TEST); glScissor(x, y, width, height); // Draw some components... mListView.draw(); // mListView is an object of ListView type glDisable(GL_SCISSOR_TEST); } ListView::draw() { glEnable(GL_SCISSOR_TEST); glScissor(x, y, width, height); // Draw a chosen part of ListView here glDisable(GL_SCISSOR_TEST); }
But, of course, in this situation, allowing / disabling calls is not so:
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
If I delete these internal calls to glEnable / glDisable (those listed in the ListView), I would somehow encounter two calls to glScissor (), which also seem to be incorrect.
EDIT
I would like to achieve both effects of scissors somehow, I mean that Window should draw only a region with scissors in it and the internal ListView also only in the scissored area.
As you can see in the picture, with the red rectangle, I have the scissor area for Window marked, which is WORKS, and with the blue rectangle, I selected the area on which I would like to draw my ListView . That is why I tried to use nested scissors, but I know that it is useless. So basically my question is: what could be the best approach to achieve this?
