///////////////////////////////////////////////////////
| 656 | |
| 657 | //////////////////////////////////////////////////////////// |
| 658 | void RenderTarget::applyCurrentView() |
| 659 | { |
| 660 | // Set the viewport |
| 661 | const IntRect viewport = getViewport(m_view); |
| 662 | const int viewportTop = static_cast<int>(getSize().y) - (viewport.position.y + viewport.size.y); |
| 663 | glCheck(glViewport(viewport.position.x, viewportTop, viewport.size.x, viewport.size.y)); |
| 664 | |
| 665 | // Set the scissor rectangle and enable/disable scissor testing |
| 666 | if (m_view.getScissor() == FloatRect({0, 0}, {1, 1})) |
| 667 | { |
| 668 | if (!m_cache.enable || m_cache.scissorEnabled) |
| 669 | { |
| 670 | glCheck(glDisable(GL_SCISSOR_TEST)); |
| 671 | m_cache.scissorEnabled = false; |
| 672 | } |
| 673 | } |
| 674 | else |
| 675 | { |
| 676 | const IntRect pixelScissor = getScissor(m_view); |
| 677 | const int scissorTop = static_cast<int>(getSize().y) - (pixelScissor.position.y + pixelScissor.size.y); |
| 678 | glCheck(glScissor(pixelScissor.position.x, scissorTop, pixelScissor.size.x, pixelScissor.size.y)); |
| 679 | |
| 680 | if (!m_cache.enable || !m_cache.scissorEnabled) |
| 681 | { |
| 682 | glCheck(glEnable(GL_SCISSOR_TEST)); |
| 683 | m_cache.scissorEnabled = true; |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | // Set the projection matrix |
| 688 | glCheck(glMatrixMode(GL_PROJECTION)); |
| 689 | glCheck(glLoadMatrixf(m_view.getTransform().getMatrix())); |
| 690 | |
| 691 | // Go back to model-view mode |
| 692 | glCheck(glMatrixMode(GL_MODELVIEW)); |
| 693 | |
| 694 | m_cache.viewChanged = false; |
| 695 | } |
| 696 | |
| 697 | |
| 698 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected