> On Jun 11, 2016, at 7:43 AM, Richard Charles <rcharles...@gmail.com> wrote: > > 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.
> On Jun 16, 2016, at 6:19 PM, James Walker <jam...@frameforge3d.com> wrote: > > I doubt that it is necessary to lock focus on the view, because you are not > really drawing in the view or even in the window. You are drawing in a > separate "surface" that is normally in a layer above the window. See > NSOpenGLCPSurfaceOrder. A typical implementation of lockFocus for use with OpenGL might look like this. - (void)lockFocus { NSOpenGLContext* context = [self openGLContext]; if ([context view] != self) { [context setView:self]; } [context makeCurrentContext]; } If you have only one OpenGL context in your app and it is the current context for the view then you do not need to lock focus. So I think the takeaway is that draw calls operate within a graphic context. If the context you want and need is the current context then you are good to go. I suppose it might be different if you are drawing full screen rather than into a window or view. Drawing full screen your app could still have multiple graphic contexts. If your full screen app has only one graphic context then you are good to go. I am no expert in OpenGL or Cocoa but I think this is the way it works. --Richard Charles _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com