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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to