Re: opengl rendering outside of -drawRect:
Re: opengl rendering outside of -drawRect:
- Subject: Re: opengl rendering outside of -drawRect:
- From: Richard Charles <email@hidden>
- Date: Sat, 11 Jun 2016 07:43:54 -0600
> On Jun 11, 2016, at 7:13 AM, Stefano Pigozzi <email@hidden> 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@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