Graphics Reference
In-Depth Information
{
[ super viewDidLoad ];
//set up context
self . glContext = [[ EAGLContext alloc ] initWithAPI :
kEAGLRenderingAPIOpenGLES2 ];
[ EAGLContext setCurrentContext : self . glContext ];
//set up layer
self . glLayer = [ CAEAGLLayer layer ];
self . glLayer . frame = self . glView . bounds ;
[ self . glView . layer addSublayer : self . glLayer ];
self . glLayer . drawableProperties = @{ kEAGLDrawablePropertyRetainedBacking :
@NO ,
kEAGLDrawablePropertyColorFormat :
kEAGLColorFormatRGBA8 } ;
//set up base effect
self . effect = [[ GLKBaseEffect alloc ] init ];
//set up buffers
[ self setUpBuffers ];
//draw frame
[ self drawFrame ];
}
- ( void )viewDidUnload
{
[ self tearDownBuffers ];
[ super viewDidUnload ];
}
- ( void )dealloc
{
[ self tearDownBuffers ];
[ EAGLContext setCurrentContext: nil ];
}
@end
Search WWH ::




Custom Search