From 148f0f1d248d59c2efca150a03a3e24f552087a6 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 27 Apr 2017 09:17:08 +0200 Subject: [PATCH] Fix GL error GL_INVALID_ENUM in ReadPixels --- indra/llappearance/lltexlayer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index c5218e1e60..03078e7567 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -1577,7 +1577,16 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC } alpha_data = new U8[width * height]; mAlphaCache[cache_index] = alpha_data; - glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data); + // Format GL_ALPHA is invalid for glReadPixels + //glReadPixels(x, y, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, alpha_data); + U8* alpha_buffer = new U8[width * height * 4]; + glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, alpha_buffer); + for (S32 i = 0; i < width * height; ++i) + { + alpha_data[i] = alpha_buffer[i * 4]; + } + delete[] alpha_buffer; + // } getTexLayerSet()->getAvatarAppearance()->dirtyMesh();