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
replicates most of the functionality of
UIImageView
, but can display PVRTC images
without requiring you to write any OpenGL code.