Hi,
I would like to have an OpenGL view with an utility application.
What I do: I create an OpenGL ES application template and a Utility Application template. I copy the files EAGLView.m and h, and the five ES*renderer.* files from the Opengl project to the utility project.
I copy these lines from the OpenGl project to the Utility project: (in utilityAppDelegate.m)
- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[glView startAnimation];
}
- (void) applicationWillResignActive:(UIApplication *)application
{
[glView stopAnimation];
}
- (void) applicationDidBecomeActive:(UIApplication *)application
{
[glView startAnimation];
}
- (void)applicationWillTerminate:(UIApplication *)application
{
[glView stopAnimation];
}
- (void)dealloc {
...
[glView release];
...
}
And in the utilityAppDelegate.h I add:
@class EAGLView;
EAGLView *glView;
@property (nonatomic, retain) IBOutlet EAGLView *glView;
I go to the view's identity inspector, and change the class identity to EAGLview.
I open the mainview.xib and mainwindow.xib and drag the app_delegate from the mainwindow.xib, to be able to connect the glView outlet to the view. (Don't know if this is the way to do it, but that's the only way I could connect the glView variable to the view)
When I build and run, the multi colored square show up on the screen, but it does not animate!
When I debug, the glView variable is 0 in applicationDidFinishLaunching, and the startAnimation is not called. I suspect this has something to to with the way the outlet is connected to the view? Probably not connected. :-) The mistake is probably obvious, but I have only been 5 weeks on this platform.
What is missing? What have I done wrong?
Thank you!