Showing the changes to interface/src/renderer/TextureCache.cpp (1 of 1 file). Show all
Unified · Split
| @@ -74,15 +74,17 @@ GLuint TextureCache::getPermutationNormalTextureID() { · 73 unmodified lines | ||
| 74 | 74 | return _permutationNormalTextureID; |
| 75 | 75 | } |
| 76 | 76 | |
| 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); | |
| 80 | + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
| 81 | +} | |
| 82 | + | |
| 77 | 83 | GLuint TextureCache::getWhiteTextureID() { |
| 78 | 84 | if (_whiteTextureID == 0) { |
| 79 | 85 | glGenTextures(1, &_whiteTextureID); |
| 80 | 86 | glBindTexture(GL_TEXTURE_2D, _whiteTextureID); |
| 81 | − | |
| 82 | − const char OPAQUE_WHITE[] = { 0xFF, 0xFF, 0xFF, 0xFF }; | |
| 83 | − glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, OPAQUE_WHITE); | |
| 84 | − glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
| 85 | − | |
| 87 | + loadWhiteTexture(); | |
| 86 | 88 | glBindTexture(GL_TEXTURE_2D, 0); |
| 87 | 89 | } |
| 88 | 90 | return _whiteTextureID; |
| @@ -214,6 +216,11 @@ NetworkTexture::NetworkTexture(const QUrl& url) : _reply(NULL), _averageColor(1. · 125 unmodified lines | ||
| 214 | 216 | |
| 215 | 217 | connect(_reply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleDownloadProgress(qint64,qint64))); |
| 216 | 218 | connect(_reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleReplyError())); |
| 219 | + | |
| 220 | + // default to white | |
| 221 | + glBindTexture(GL_TEXTURE_2D, getID()); | |
| 222 | + loadWhiteTexture(); | |
| 223 | + glBindTexture(GL_TEXTURE_2D, 0); | |
| 217 | 224 | } |
| 218 | 225 | |
| 219 | 226 | NetworkTexture::~NetworkTexture() { |