///////////////////////////////////////////////////////
| 833 | |
| 834 | //////////////////////////////////////////////////////////// |
| 835 | void Texture::setRepeated(bool repeated) |
| 836 | { |
| 837 | if (repeated == m_isRepeated) |
| 838 | { |
| 839 | return; |
| 840 | } |
| 841 | |
| 842 | m_isRepeated = repeated; |
| 843 | |
| 844 | if (!m_texture) |
| 845 | { |
| 846 | return; |
| 847 | } |
| 848 | |
| 849 | const TransientContextLock lock; |
| 850 | |
| 851 | // Make sure that the current texture binding will be preserved |
| 852 | const priv::TextureSaver save; |
| 853 | |
| 854 | static const bool textureEdgeClamp = GLEXT_texture_edge_clamp; |
| 855 | |
| 856 | if (!m_isRepeated && !textureEdgeClamp) |
| 857 | { |
| 858 | static bool warned = false; |
| 859 | |
| 860 | if (!warned) |
| 861 | { |
| 862 | err() << "OpenGL extension SGIS_texture_edge_clamp unavailable" << '\n' |
| 863 | << "Artifacts may occur along texture edges" << '\n' |
| 864 | << "Ensure that hardware acceleration is enabled if available" << std::endl; |
| 865 | |
| 866 | warned = true; |
| 867 | } |
| 868 | } |
| 869 | |
| 870 | #ifndef SFML_OPENGL_ES |
| 871 | const GLint textureWrapParam = m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP); |
| 872 | #else |
| 873 | const GLint textureWrapParam = m_isRepeated ? GL_REPEAT : GLEXT_GL_CLAMP_TO_EDGE; |
| 874 | #endif |
| 875 | |
| 876 | glCheck(glBindTexture(GL_TEXTURE_2D, m_texture)); |
| 877 | glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureWrapParam)); |
| 878 | glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureWrapParam)); |
| 879 | } |
| 880 | |
| 881 | |
| 882 | //////////////////////////////////////////////////////////// |
no outgoing calls
no test coverage detected