> On Jun 11, 2016, at 7:13 AM, Stefano Pigozzi <[email protected]> 
> wrote:
> 
> If using double buffering, do you have any idea if I can just lockFocus 
> before calling `CGLFlushDrawable` and unlockFocus after it? Or do I have to 
> wrap all the OpenGL calls drawing to the back buffer in lockFocus?

[NSView lockFocus];
// drawing calls
// CGL calls
// gl calls
[NSView unlockFocus];

Before calling drawRect:, the system locks focus on the view. Each view has its 
own graphic context. When the focus is locked on a view, the view’s graphics 
context is active. When the focus is unlocked, the graphics context is no 
longer active. Drawing commands are always executed in the current graphic 
context.

Refer to Objective-C Programming by Hillegass. Also refer to OpenGL Programming 
Guide for Mac OS X, Drawing OpenGL Content to a Custom View.

--Richard Charles


_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to