Should Cocos2D take EAGLview from openFrameworks, or vice versa?
Trying to get Cocos2D and openFrameworks to play nicely together on iOS
. Both want to use GL
/ EAGLview
, and of course they can't just both do glView = [[EAGLView alloc] init]
because you can't have two root views. One has to init
and the other one needs to have its glView
pointer assigned to the other. What I'm doing right now:
#ifdef __COCOS2D__
glView = [[CCDirector sharedDirector] openGLView];
#else // this is the standard openFrameworks GL init code
glView = [[EAGLView alloc] initWithFrame:screenBounds andDepth:iPhoneGetOFWindow()->isDepthEnabled() andAA:iPhoneGetOFWindow()->isAntiAliasingEnabled() andNumSamples开发者_如何学C:iPhoneGetOFWindow()->getAntiAliasingSampleCount() andRetina:iPhoneGetOFWindow()->isRetinaSupported()];
And it gives me a black screen if I #define __COCOS2D__
.
Where can I learn what I need to know about EAGLView
in order to init
it in a way that makes both Cocos2D and openFrameworks happy?
Or, if you're feeling particularly saintly: Why am I getting a black screen and what can I do about it?
My working answer: Have only one of the frameworks (Cocos2D) do all the drawing. openFrameworks can handle modeling and so on behind the scenes, but doesn't actually ever set up an openGL context.
Still would love to hear if you've gotten them actually, fully, working together though...
精彩评论