代码如下 :
- (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来显示。
- (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来显示。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货