私の cocos3d アプリケーションでは、rootview コントローラーとして UIViewController があり、オプションをクリックすると、そこから再び Cocos3d シーンを起動します。
このView Controllerからシーンを起動するためのコードは次のとおりです。問題は、uiviewcontroller を開き、オプションを 2 回以上クリックしてシーンに移動すると、"OpenGL error 0x0506 in -[EAGLView swapBuffers] [ GL ERROR ] Unknown GL error (1286), before図面 HomeOwners3DScene 無名:1691。さらに調査するには、プロジェクトのビルド設定でプリプロセッサ マクロ GL_ERROR_TRACING_ENABLED=1 を設定してください。"
[この問題は、シーンを表示したときに最初に発生するのではなく、適切に表示されます。しかし、戻ってクリックしてシーンを2回以上表示すると、xcodeで以下のエラーが表示されて空白のシーンのように見えます]
ビューコントローラーからさらにシーンに移動するための以下のコード:
-(void) launchMainScene :(UIViewController *) uiViewCrtller
{
[uiViewCrtller.view removeFromSuperview];
// This must be the first thing we do and must be done before establishing view controller.
if( ! [CCDirector setDirectorType: kCCDirectorTypeDisplayLink] )
[CCDirector setDirectorType: kCCDirectorTypeDefault];
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images.
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565. You can change anytime.
CCTexture2D.defaultAlphaPixelFormat = kCCTexture2DPixelFormat_RGBA8888;
// Create the view controller for the 3D view.
viewController = [CC3DeviceCameraOverlayUIViewController new];
//viewController.supportedInterfaceOrientations = UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
// Create the CCDirector, set the frame rate, and attach the view.
CCDirector *director = CCDirector.sharedDirector;
//director.runLoopCommon = YES; // Improves display link integration with UIKit
[director setDeviceOrientation:kCCDeviceOrientationPortrait];
director.animationInterval = (1.0f / kAnimationFrameRate);
director.displayFPS = YES;
director.openGLView = viewController.view;
// Enables High Res mode on Retina Displays and maintains low res on all other devices
// This must be done after the GL view is assigned to the director!
[director enableRetinaDisplay: YES];
[director setDepthTest:NO];
// Create the window, make the controller (and its view) the root of the window, and present the window
[window addSubview: viewController.view];
CCDirector.sharedDirector.displayFPS = NO;
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
// Set to YES for Augmented Reality 3D overlay on device camera.
// This must be done after the window is made visible!
viewController.isOverlayingDeviceCamera = NO;
// Create the customized CC3Layer that supports 3D rendering and schedule it for automatic updates.
CC3Layer* cc3Layer = [HomeOwners3DLayer node];
[cc3Layer scheduleUpdate];
// Create the customized 3D scene and attach it to the layer.
// Could also just create this inside the customer layer.
cc3Layer.cc3Scene = [HomeOwners3DScene scene];
// Assign to a generic variable so we can uncomment options below to play with the capabilities
CC3ControllableLayer* mainLayer = cc3Layer;
CCScene *scene = [CCScene node];
[scene addChild: mainLayer];
[[CCDirector sharedDirector] runWithScene: scene];
}
以下のエラーは、シーンを起動してビューコントローラーに戻り、シーンに空白の画面を表示してシーンを複数回起動すると、Xcode コンソールにスローされ ます。しかし、戻ってクリックしてシーンを 2 回以上表示すると、空白のシーンのように見え、xcode で以下のエラーが表示されます] * [EAGLView swapBuffers] での OpenGL エラー 0x0506 [ GL エラー] 不明な GL エラー ( 1286)、HomeOwners3DScene を描画する前に 無名:1691。さらに調査するには、プロジェクトのビルド設定でプリプロセッサ マクロ GL_ERROR_TRACING_ENABLED=1 を設定します。
私の問題を解決するのを手伝ってください。
ありがとうございました。