Problems using PVRTC on an N95 8GB

Hallo,

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?

Best regards,

Andi

Hi,

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, Andi

What parameters are you passing to glCompressedTexImage2D exactly?

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?

Best regards,

Andi

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 8x8 for PVRTC4 and 16x8 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.

I had a look in this library before, but I didn't saw these information in there. So I'll dig in a bit deeper.

Thank you very much for this information!