Showing the changes to interface/src/renderer/TextureCache.cpp (1 of 13 files). Show all
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | TextureCache::TextureCache() : |
| 21 | 21 | _permutationNormalTextureID(0), |
| 22 | 22 | _whiteTextureID(0), |
| 23 | + _blueTextureID(0), | |
| 23 | 24 | _primaryFramebufferObject(NULL), |
| 24 | 25 | _secondaryFramebufferObject(NULL), |
| 25 | 26 | _tertiaryFramebufferObject(NULL) |
| @@ -74,9 +75,11 @@ GLuint TextureCache::getPermutationNormalTextureID() { · 48 unmodified lines | ||
| 74 | 75 | return _permutationNormalTextureID; |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | −static void loadWhiteTexture() { | |
| 78 | − const char OPAQUE_WHITE[] = { 0xFF, 0xFF, 0xFF, 0xFF }; | |
| 79 | − glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, OPAQUE_WHITE); | |
| 78 | +const char OPAQUE_WHITE[] = { 0xFF, 0xFF, 0xFF, 0xFF }; | |
| 79 | +const char OPAQUE_BLUE[] = { 0x80, 0x80, 0xFF, 0xFF }; | |
| 80 | + | |
| 81 | +static void loadSingleColorTexture(const char* color) { | |
| 82 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, color); | |
| 80 | 83 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 81 | 84 | } |
| 82 | 85 | |
| @@ -84,12 +87,22 @@ GLuint TextureCache::getWhiteTextureID() { · 1 unmodified line | ||
| 84 | 87 | if (_whiteTextureID == 0) { |
| 85 | 88 | glGenTextures(1, &_whiteTextureID); |
| 86 | 89 | glBindTexture(GL_TEXTURE_2D, _whiteTextureID); |
| 87 | − loadWhiteTexture(); | |
| 90 | + loadSingleColorTexture(OPAQUE_WHITE); | |
| 88 | 91 | glBindTexture(GL_TEXTURE_2D, 0); |
| 89 | 92 | } |
| 90 | 93 | return _whiteTextureID; |
| 91 | 94 | } |
| 92 | 95 | |
| 96 | +GLuint TextureCache::getBlueTextureID() { | |
| 97 | + if (_blueTextureID == 0) { | |
| 98 | + glGenTextures(1, &_blueTextureID); | |
| 99 | + glBindTexture(GL_TEXTURE_2D, _blueTextureID); | |
| 100 | + loadSingleColorTexture(OPAQUE_BLUE); | |
| 101 | + glBindTexture(GL_TEXTURE_2D, 0); | |
| 102 | + } | |
| 103 | + return _blueTextureID; | |
| 104 | +} | |
| 105 | + | |
| 93 | 106 | GLuint TextureCache::getFileTextureID(const QString& filename) { |
| 94 | 107 | GLuint id = _fileTextureIDs.value(filename); |
| 95 | 108 | if (id == 0) { |
| @@ -219,7 +232,7 @@ NetworkTexture::NetworkTexture(const QUrl& url) : _reply(NULL), _averageColor(1. · 123 unmodified lines | ||
| 219 | 232 | |
| 220 | 233 | // default to white |
| 221 | 234 | glBindTexture(GL_TEXTURE_2D, getID()); |
| 222 | − loadWhiteTexture(); | |
| 235 | + loadSingleColorTexture(OPAQUE_WHITE); | |
| 223 | 236 | glBindTexture(GL_TEXTURE_2D, 0); |
| 224 | 237 | } |
| 225 | 238 | |