| 5 | namespace Texture |
| 6 | { |
| 7 | void Cube_Map::load(const std::array<std::string, 6>& textureFiles) |
| 8 | { |
| 9 | glGenTextures(1, &m_textureID); |
| 10 | glActiveTexture(GL_TEXTURE0); |
| 11 | glBindTexture(GL_TEXTURE_CUBE_MAP, m_textureID); |
| 12 | |
| 13 | for (int i = 0; i < 6; i++) |
| 14 | { |
| 15 | sf::Image image; |
| 16 | image.loadFromFile(textureFiles[i]); |
| 17 | glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, |
| 18 | 0, |
| 19 | GL_RGB, |
| 20 | image.getSize().x, |
| 21 | image.getSize().y, |
| 22 | 0, |
| 23 | GL_RGB, |
| 24 | GL_UNSIGNED_BYTE, |
| 25 | image.getPixelsPtr()); |
| 26 | } |
| 27 | glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 28 | glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 29 | glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 30 | glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 31 | glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); |
| 32 | glBindTexture(GL_TEXTURE_CUBE_MAP, 0); |
| 33 | } |
| 34 | |
| 35 | } |
nothing calls this directly
no test coverage detected