문제

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: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...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top