NekoChan
07-16-2008, 02:30 AM
I took a sample code from apple to make a texture loader with openglES...
Here it is :
// Creates a Core Graphics image from an image file
spriteImage = [UIImage imageNamed:@"Sprite.png"].CGImage;
// Get the width and height of the image
width = CGImageGetWidth(spriteImage);
height = CGImageGetHeight(spriteImage);
// Texture dimensions must be a power of 2. If you write an application that allows users to supply an image,
// you'll want to add code that checks the dimensions and takes appropriate action if they are not a power of 2.
Why the heck textures dimensions should be power of 2 ??
Does anyone know another way to load textures (which size is not obviously power of 2) ?
Here it is :
// Creates a Core Graphics image from an image file
spriteImage = [UIImage imageNamed:@"Sprite.png"].CGImage;
// Get the width and height of the image
width = CGImageGetWidth(spriteImage);
height = CGImageGetHeight(spriteImage);
// Texture dimensions must be a power of 2. If you write an application that allows users to supply an image,
// you'll want to add code that checks the dimensions and takes appropriate action if they are not a power of 2.
Why the heck textures dimensions should be power of 2 ??
Does anyone know another way to load textures (which size is not obviously power of 2) ?