Hi, I draw guis in several panels, I’ve made a test if the gui is not entierly in the panel I don’t draw it.
But if the gui intersects the border of the panel, I want to draw the part of the gui which is in the panel.
I tried to use glScissor.
void draw(RenderTarget& target, RenderStates states) {
glCheck(glEnable(GL_SCISSOR_TEST));
glCheck(glScissor(getPosition().x, getPosition().y,getSize().x,getSize().y));
onDraw(target, states);
std::multimap<int, LightComponent*, std::greater<int>> sortedChildren;
for (unsigned int i = 0; i < children.size(); i++) {
sortedChildren.insert(std::make_pair(children[i]->getPriority(), children[i].get()));
}
std::multimap<int, LightComponent*, std::greater<int>>::iterator it;
for (it = sortedChildren.begin(); it != sortedChildren.end(); it++) {
if (it->second->isVisible() && it->second->getPosition().x + it->second->getSize().x >= getPosition().x && it->second->getPosition().y + it->second->getSize().y >= getPosition().y
&& it->second->getPosition().x <= getPosition().x + getSize().x
&& it->second->getPosition().y <= getPosition().y + getSize().y) {
it->second->draw(target, states);
}
}
drawOn(target, states);
glCheck(glDisable(GL_SCISSOR_TEST));
}
But even if the gui is inside the panel it doesn’t draw it.
And it seems that sometimes panels are even not drawn!
position and size are the position and the size of the panel.
children[i]->position and children[i]->size are the guis that I draw on the panel.
But I’ve a question what is the system coordinates of opengl ? Is the top left corner with have 0 as y position or is it the bottom left corner ?
PS : hum it seems that it’s exactly the same coordinates as the windows I displayed the values with getIntegerv from one panel : (0, 10, 200, 700) but nothing is drawn inside that area…