I'm new to the whole Cocoa/Objective-C malarky (but have years of C/C++ on *nix).
I'm trying to create a basic Cocoa application that is filled with an NSOpenGLView. I have:
chink.mm
#import <OpenGL/gl.h>
#import "chink.h"
@implementation chinkView
@synthesize window;
- (void) applicationDidFinishLaunching : (NSNotification *)aNotification {
NSLog(@"Danger, Will Robinson! Danger!");
}
- (void) dealloc
{
[window release];
[super dealloc];
}
@end
and chink.h
@interface chinkView : NSOpenGLView {
NSWindow *window;
}
@property (assign) NSWindow *window;
@end
I have a single .xib set up like
https://skitch.com/cront/ri625/chinkxib
where 'chink View' is set as delegate for Window and File Owner.
I'm getting an 'invalid drawable' error (even before the application finished launching), which to my understanding means that it is trying to instantiate the opengl view before the window (although I'm probably wrong).
What I want is the solution to this problem of creating the window and setting the opengl view inside it. Once this is done I have absolutely no problem writing the OGL (like I said, I know C++) but all this NS calls gunk is alien to me.
I'm not looking for 'why don't you do it in SDL/GLUT' answers please. Just the code to make it create the window properly.