I start my cocos scene calling following function in a UIViewController (yes, I must call it from a UIViewController) with a 425x320 size of view.
-(void) runCocos2d
{
EAGLView *glview = [EAGLView viewWithFrame:CGRectMake(0, 0, 320, 320)];
CCDirector *director = [CCDirector sharedDirector];
[director setDisplayFPS:YES];
[director setOpenGLView:glview];
CCScene *scene = [CCScene node];
id node = [LayerExample node];
[scene addChild: node];
[director runWithScene:scene];
[self.view addSubview:glview];
}
It shows perfectly on the simulator but not on the device (I only get a black view there). And if I change the first line to
EAGLView *glview = [EAGLView viewWithFrame:CGRectMake(0, 0, 425, 320)];
(only change the width of the EAGLView)
It doesn't show on the simulator neither anymore.
I didn't use the templates, I configured it like in this post.
Cocos2d output:
2010-12-08 17:45:01.905[16537:207] cocos2d: GL_VENDOR: Apple Computer, Inc. 2010-12-08 17:45:01.905[16537:207] cocos2d: GL_RENDERER: Apple Software Renderer 2010-12-08 17:45:01.906[16537:207] cocos2d: GL_VERSION: OpenGL ES-CM 1.1 APPLE 2010-12-08 17:45:01.906[16537:207] cocos2d: GL_MAX_TEXTURE_SIZE: 2048 2010-12-08 17:45:01.906[16537:207] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16 2010-12-08 17:45:01.907[16537:207] cocos2d: GL supports PVRTC: YES 2010-12-08 17:45:01.907[16537:207] cocos2d: GL supports BGRA8888 textures: NO 2010-12-08 17:45:01.909[16537:207] cocos2d: GL supports NPOT textures: YES 2010-12-08 17:45:01.909[16537:207] cocos2d: GL supports discard_framebuffer: YES 2010-12-08 17:45:01.910[16537:207] cocos2d: compiled with NPOT support: NO 2010-12-08 17:45:01.910[16537:207] cocos2d: compiled with VBO support in TextureAtlas : YES 2010-12-08 17:45:01.910[16537:207] cocos2d: compiled with Affine Matrix transformation in CCNode : YES 2010-12-08 17:45:01.911[16537:207] cocos2d: compiled with Profiling Support: NO 2010-12-08 17:45:01.912[16537:207] cocos2d: cocos2d v0.99.4 2010-12-08 17:45:01.912[16537:207] cocos2d: Using Director Type:CCTimerDirector
Thanks in advance!