- August 6, 2008 at 9:50 pm #29559
I’m trying to use PVRTC Textures on an N95 8GB Device. Everything is going fine until the moment, when I try to upload the texture to the opengl server side. Trying to upload the texture data with glCompressedTexImage2D gives me gl error GL_INVALID_ENUM for the texture format: GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG defined with value 0x8C01.
Checking for the extension says, that the pvrtc extension is available on the device.
Can you tell me what is happening here?
AndiAugust 7, 2008 at 2:39 pm #32220
i was wrong. The gl error thrown is GL_INVALID_VALUE not GL_INVALID_ENUM. I found out, that this error is allways thrown, when the PVRTC Texture includes mipmaps. Without mipmaps everything is going fine.
The Textures are generated with sdk command line tool. Any idea, whats going wrong here?
Regards, AndiAugust 7, 2008 at 3:17 pm #32221
What parameters are you passing to glCompressedTexImage2D exactly?August 7, 2008 at 9:31 pm #32222
Nearly all parameters come from the texture header:
glCompressedTexImage2D(GL_TEXTURE_2D, levels, format, width, height, 0, size, data);
levels: in actuall test texture == 6
format: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG or Â Â Â Â Â Â Â GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG ( it is not working with both formats )
width and height == 64
size: dont know exactly, but it is the texture data length field from header
data: texture data without header
Any idea, Xmas?
AndiAugust 8, 2008 at 10:16 am #32223
You have to load each mipmap level individually, with the level parameter going from 0 to 5. It’s slightly complicated by the fact that PVRTC has a minimum size of 8×8 for PVRTC4 and 16×8 for PVRTC2 for the purpose of calculating the data size. This does not affect the width and height parameters.
I’d recommend using the PVRTools library from our SDK to load PVR files. If you want to see what the library does have a look at the function PVRTLoadPartialTextureFromPointer in ToolsOGLESPVRTTextureAPI.cpp.