I have a project that I'm working on that needs to be able to display and interact with several different models. One of these views is full screen (iPad Landscape), and the others are smaller subviews. The issues that I'm currently running across are as follows:
Creating the CCGLView manually and applying it to the shared director causes all sorts of GL errors, specifically having to do with the swapBuffers method of the CCGLView.
Since the director of Cocos3D is a subclass of UIViewController and it's also a singleton, it makes it very difficult / unpleasant to attempt to have multiple views in the project without creating a complicated stack to control where and what view is currently active / needs to be displayed.
Along with these factors, the overall hierarchy of the project (due to it's complete custom nature using all custom controls), I'm having to use a containment view controller to manage navigation between all the different view controllers in the project. Couple this with a singleton that only allows one GLView to interact with in the context of Cocos3D, and you can see where this starts to become a mess.
Does anybody have any suggestions on what to do? If you have any ideas on what I may be doing wrong in the instantiation of my GLView, that would also at least be a start.
_director = CocosViewController.sharedDirector;
_director.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll;
_director.viewShouldUseStencilBuffer = NO; // Set to YES if using shadow volumes
_director.viewPixelSamples = 1; // Set to 4 for antialiasing multisampling
_director.animationInterval = (1.0f / kAnimationFrameRate);
_director.displayStats = NO;
[_director enableRetinaDisplay: YES];
CCGLView *glView = [CCGLView viewWithFrame:_director.view.frame
pixelFormat:kEAGLColorFormatRGBA8
depthFormat:0 preserveBackbuffer:NO
sharegroup:nil
multiSampling:NO
numberOfSamples:0];
glView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[_director setCcGLView:glView];
Just simply doing that doesn't work and gives me a black screen with OpenGL errors 0x502 errors.
Cocos2D 2.0 is not designed to work with more than one view, and it's anything but trivial to "fix" this.
Since cocos3d requires cocos2d, you're out of luck here. Stick to a single view.