I'm looking for a sample application that uses Apple's new GLKView object whith other UIObjects like UIButton in the same window. I was searching that from the internet and the more like post I found wasthat and is not answered:
In the application I'm creating I need to use the GLKView with 2 UIButton in the same view. Depending of what Button I press I change the parameters of the GLKView. How the ViewController should handle the GLKView? Should I have a GLKViewController separate of the actual view controller to controll only the GLKView?
I tried to make my view controller inherit GLKViewController.
@interface ViewController : GLKViewController <GLKViewControllerDelegate, GLKViewDelegate>
And set up the GLKView named OpenGLView in the viewDidLoadFunction:
- (void)viewDidLoad
{
[super viewDidLoad];
EAGLContext *aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
openGlView.delegate = self;
openGlView.context = aContext;
openGlView.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
openGlView.drawableDepthFormat = GLKViewDrawableDepthFormat16;
openGlView.drawableMultisample = GLKViewDrawableMultisample4X;
self.delegate = self;
self.preferredFramesPerSecond = 30;
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
The build goes well but when I run the application it crash saying:
'NSInternalInconsistencyException', reason: '-[GLKViewController loadView] loaded the "2-view-5" nib but didn't get a GLKView.'
Can someone help me? I was searching an example for this but I doesn't find it
Jordi P
The error message you're getting means that the GLKViewController subclass, your viewController, cannot find the expected outlet to a GLKView. In IB the view property of your viewController MUST be connected to a GLKView (or subclass) to work correctly.