Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad UIViewController programmatically? (OpenGL ES 2.0)
    text
    copied!<p>I tried to get the XCode openGL ES template running without the xib files from interface builder. But still getting at this line <code>[(EAGLView *)self.view setContext:context];</code> an [UIView setContext:]: unrecognized selector sent to instance 0x4b1fac0 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setContext:]: unrecognized selector sent to instance 0x4b1fac0</p> <p>What I'm doing wrong?</p> <p>main.mm</p> <pre><code>int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, @"myAppDelegate"); [pool release]; return retVal; } </code></pre> <p>myAppDelegate.m</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.viewController = [[myViewController alloc] initWithNibName:nil bundle:nil]; self.window.rootViewController = self.viewController; return YES; } </code></pre> <p>myViewController.m</p> <pre><code>- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { EAGLContext *aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; if (!aContext) { aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1]; } if (!aContext) NSLog(@"Failed to create ES context"); else if (![EAGLContext setCurrentContext:aContext]) NSLog(@"Failed to set ES context current"); self.context = aContext; [aContext release]; [(EAGLView *)self.view setContext:context]; [(EAGLView *)self.view setFramebuffer]; if ([context API] == kEAGLRenderingAPIOpenGLES2) [self loadShaders]; animating = FALSE; animationFrameInterval = 1; self.displayLink = nil; return 0; } </code></pre> <p>I removed the default xib from my plist file (and the xib files from the project) and also every IBoutlet. Have I missed anything? I'm guessing my appDelegate is wrong something - but can't figure out what or why. Any help would be highly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload