How to custom init an EAGLView?
In my iOS project, glView
ends up with height=0 and width=0 even though CGRect frame
correctly gets the screen's dimensions in the previous line.
- (void) applicationDidFinishLaunching:(UIApplication*)application {
CGRect frame = [[UIScreen mainScreen] bounds];
EAGLView *glView = [EAGLView viewWithFrame:frame
pixelFormat:kEAGLColorFormatRGB565
depthFormat:0
preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0
];
}开发者_开发技巧
Is there some other way I need to create my EAGLView *glView
in order for it to be init
'ed properly?
You will have to add the glView to a UIWindow. Check out the app delegate code in the Cocos2D project templates.
精彩评论