GLKView怎么不让controller自动调用DrawRect啊
heyyg 2016-04-07 04:36:21 代码如下 :
- (void)viewDidLoad {
[super viewDidLoad];
context = [self CreateBestEAGLContext];
if (!context) {
NSLog(@"Failed to create ES context");
}
GLKView *view = (GLKView *)self.view;
view.context = context;
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
view.drawableStencilFormat = GLKViewDrawableStencilFormat8;
view.enableSetNeedsDisplay = NO;
[EAGLContext setCurrentContext:context];
int w = view.frame.size.width;
int h = view.frame.size.height;
}
-(void)glkView:(GLKView *)view drawInRect:(CGRect)rect
{
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //清除surface内容,恢复至初始状态。
NSLog(@"drawBegin");
// renderFrame();
glDraw(token, true);
NSLog(@"drawEnd");
}
drawInRect会不停的调用,我想我需要的时候 调用display来显示。