Programming Tutorials

Using NSOpenGLView in Cocoa Programming in Mac

By: Aaron Hillegass in Cocoa Tutorials on 2010-09-24  

NSOpenGLView is an NSView subclass that has an OpenGL drawing context. Just as you needed the focus locked on a view to do drawing with Quartz, so the OpenGL drawing context must be active for any OpenGL drawing commands to have an effect.

Here are some important methods in NSOpenGLView:

- (id)initWithFrame:(NSRect)frameRect
         pixelFormat:(NSOpenGLPixelFormat *)format

The designated initializer.

- (NSOpenGLContext*)openGLContext

Returns the view's OpenGL context.

- (void)reshape

Called when the view is resized. The OpenGL context is active when this method is called.

- (void)drawRect:(NSRect)r

Called when the view needs to be redrawn. The OpenGL context is active when this method is called.






Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Cocoa )

Latest Articles (in Cocoa)