OpenGL ES, how do you render PVR textures?

2.2k Views Asked by At

Edit:ok, sorry, I had a simple programming error, is there a way to delete this question?

I have some compressed textures that are PVR files, but I cant seem to draw them in my iPad application using OpenGL ES.

I can draw PNG files just fine, I know the PVR files are being loaded correctly. Are there some special OpenGL draw functions that I need to be calling to draw the PVR files?

Edit:All I get is a white image.

Any info is appreciated.

2

There are 2 best solutions below

0
On

After upload, PVR textures are no different from other formats. Did you forgot to skip header during data upload, or used wrong parameters for glCompressedTexImage2D? It is even possible that compression tool was unable to convert images because of wrong size or color format.

0
On

Drawing PVRTC textures should be exactly the same as any other texture format - it looks more likely that your loading code is the problem. Are any GL errors being reported during loading?

The major difference to loading uncompressed textures are in the line:

glCompressedTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, width, height, 0, size, data);

or

glCompressedTexImage2D(GL_TEXTURE_2D, level, GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, width, height, 0, size, data);

Make sure that you're not setting a GL filter mode to use MIPmaps if they're not in the texture as well.

Searching for PVRTC in Apple's docs brings up a decent summary of how to use these textures.