Istvan
Istvan

Reputation: 399

Problem using PVRTC textures

I am trying to use PVRTC images instead of PNG's. The problem is, that I am not able to map see them.

Here is my code:

glGenTextures(1, &bg1Texture);
glBindTexture(GL_TEXTURE_2D, bg1Texture);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); 
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);

NSString *path = [[NSBundle mainBundle] pathForResource:@"starfield_00" ofType:@"pvr"];
NSData *texData = [[NSData alloc] initWithContentsOfFile:path];

glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG, 512, 512, 0, [texData length], [texData bytes]);

[texData release];

I use this command to create the compressed textures:

texturetool -e PVRTC --bits-per-pixel-2 -o starfield_00.pvr -f PVR starfield_00.png 

glGetError() returns 1281 (failed to bind texture). However if i check with glIsTexture (), it returns true.

Any ideas? Oh and I use OpenGL ES on the iPhone.

Upvotes: 2

Views: 2455

Answers (1)

Istvan
Istvan

Reputation: 399

After i removed the -f PVR option from the encoding procedure, i was able to load the texture and display it with RGBA option. Interestingly this encoding command line was taken from one of Apple's example programs...

Upvotes: 2

Related Questions