Hello!
I’m porting mobile game to Android and want to use compressed textures in OpenGL the same way I did on iOS with pvr textures.
I’ve managed to convert my textures from png to dxt and run the game on Galaxy Tab 10.1 with Nvidia Tegra 2 chipset.
However there were no smooth alpha in my DXT5 formatted textures. They looked like DXT1-textures with 1-bit alpha.
Please, help me with this problem. I’m really stuck.
Detailes:
-
I’ve used nvcompress tool version 2.1.0 with flags “-nomips -bc3 -alpha” (and of cause a lot of variations but with no success).
-
I’m using OpenGL ES1 library.
-
My openGL code:
GLuint texture = 0; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); int blockSize; GLuint format; switch (info.format) { case S3TC_DXT1: format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; blockSize = 8; break; case S3TC_DXT3: format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; blockSize = 16; break; case S3TC_DXT5: format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; blockSize = 16; break; case ATC: format = GL_ATC_RGBA_EXPLICIT_ALPHA_AMD; blockSize = 16; break; default: break; } RCatEngine::utils::logMsg("try to load DDS texture"); int offset = 0; for(int i = 0; i < info.numMipMaps; i++) { int size = ((width + 3) / 4) * ((height + 3) / 4) * blockSize; glCompressedTexImage2D(GL_TEXTURE_2D, i, format, width, height, 0, size, textureData + offset); offset += size; //Scale next level. width /= 2; height /= 2; }