Disable srgb texture compression for Intel

RGB texture compression works fine but it looks like srgb TC isnt
properly supported.
A later TODO would be to convert rgb to srgb in cpu and use compression
again.
This commit is contained in:
Vincent Lejeune
2014-04-05 03:13:45 +02:00
parent a57e81a37c
commit 2264f8e3a7

View File

@@ -309,10 +309,20 @@ void transformTexturesTosRGB(irr::video::ITexture *tex)
memcpy(data, tex->lock(), w * h * 4);
tex->unlock();
glBindTexture(GL_TEXTURE_2D, getTextureGLuint(tex));
if (tex->hasAlpha())
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB_ALPHA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid *)data);
if (irr_driver->getGLSLVersion() < 320)
{
if (tex->hasAlpha())
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB_ALPHA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid *)data);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_SRGB, w, h, 0, GL_BGR, GL_UNSIGNED_BYTE, (GLvoid *)data);
}
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB, w, h, 0, GL_BGR, GL_UNSIGNED_BYTE, (GLvoid *)data);
{
if (tex->hasAlpha())
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB_ALPHA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, (GLvoid *)data);
else
glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_SRGB, w, h, 0, GL_BGR, GL_UNSIGNED_BYTE, (GLvoid *)data);
}
glGenerateMipmap(GL_TEXTURE_2D);
delete[] data;
}