Graphics Reference
In-Depth Information
self . textureInfo = [ GLKTextureLoader textureWithContentsOfFile :imageFile
options : nil
error : NULL ];
//create texture
GLKEffectPropertyTexture *texture =
[[ GLKEffectPropertyTexture alloc ] init ];
texture. enabled = YES ;
texture. envMode = GLKTextureEnvModeDecal ;
texture. name = self . textureInfo . name ;
//set up base effect
self . effect = [[ GLKBaseEffect alloc ] init ];
self . effect . texture2d0 . name = texture. name ;
//set up buffers
[ self setUpBuffers ];
//draw frame
[ self drawFrame ];
}
- ( void )viewDidUnload
{
[ self tearDownBuffers ];
[ super viewDidUnload ];
}
- ( void )dealloc
{
[ self tearDownBuffers ];
[ EAGLContext setCurrentContext : nil ];
}
@end
As you can see, it's nontrivial to do this, but if you are interested in using PVRTC images
in a regular app (as opposed to an OpenGL-based game), the GLView library
( https://github.com/nicklockwood/GLView) provides a simple GLImageView class that
replicates most of the functionality of UIImageView , but can display PVRTC images
without requiring you to write any OpenGL code.
Search WWH ::




Custom Search