void clip_rect(sf::RenderTarget& where, rectangle rect) { rect &= rectangle(where); // Make sure we don't draw out of bounds // TODO: Make sure this works for the scissor test... setActiveRenderTarget(where); rectangle winRect(where); location pivot = rect.bottomLeft(); pivot = where.mapCoordsToPixel(pivot); glEnable(GL_SCISSOR_TEST); glScissor(pivot.x, rectangle(where).height() - pivot.y, rect.width(), rect.height()); }