Re: OpenGL Prog Guide for OSX - override initWithFrame
Re: OpenGL Prog Guide for OSX - override initWithFrame
- Subject: Re: OpenGL Prog Guide for OSX - override initWithFrame
- From: Richard Somers <email@hidden>
- Date: Mon, 23 Mar 2009 12:33:54 -0600
On Mar 23, 2009, at 2:51AM, Ian Jackson wrote:
I have an OpenGL view as a subclass of NSView. Trying to follow the
OpenGL Programming Guide for Mac OS X, I created all the methods
described in the "Drawing to a Cocoa View" section. The thing I
don't quite understand is that it says to override the
initWithFrame: method of the NSView class, but the sample code
describes a initWIthFrame:pixelFormat: method. I initially more or
less cobbled all the sample code together in my custom OpenGL view,
so that the initWithFrame:pixelFormat: method was included as it is
in the guide. However, there is no initWithFrame:pixelFormat method
in NSView, so the method doesn't get called.
I now override the initWIthFrame method, and include:
_pixelFormat = [[[self class] defaultPixelFormat] retain];
but, I'd like to know what the document actually intends.
The method -initWithFrame:pixelFormat: is found in NSOpenGLView not
NSView. The inheritance hierarchy is NSOpenGLView : NSView :
NSResponder : NSObject.
Richard
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden