cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e573d65424abb1f0425e183516880d30e0227a2e
commit e573d65424abb1f0425e183516880d30e0227a2e Author: pierre lamot <[email protected]> Date: Fri Jan 30 17:42:09 2015 +0100 evas: make current context on lockFocus for gl_cocoa backend. make current context on lockFocus as suggested by (following best practice): https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide @fix Signed-off-by: Cedric BAIL <[email protected]> --- .../evas/engines/gl_cocoa/evas_gl_cocoa_main.m | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m index 256bd66..6a4c0ad 100644 --- a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m +++ b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m @@ -59,13 +59,25 @@ static NSOpenGLContext *_evas_gl_cocoa_shared_context = NULL; return self; } +- (void)lockFocus +{ + NSOpenGLContext* context = [self openGLContext]; + + [super lockFocus]; + + if ([context view] != self) { + [context setView:self]; + } + [context makeCurrentContext]; +} + @end Evas_GL_Cocoa_Window * eng_window_new(void *window, - int w, - int h) + int w, + int h) { Evas_GL_Cocoa_Window *gw; @@ -81,8 +93,8 @@ eng_window_new(void *window, if (!gw->gl_context) { - free(gw); - return NULL; + free(gw); + return NULL; } evas_gl_common_context_use(gw->gl_context); evas_gl_common_context_resize(gw->gl_context, w, h, 0); @@ -106,10 +118,10 @@ eng_window_use(Evas_GL_Cocoa_Window *gw) { if (_evas_gl_cocoa_window != gw) { - [[(NSOpenGLView*)gw->view openGLContext] makeCurrentContext]; + [[(NSOpenGLView*)gw->view openGLContext] makeCurrentContext]; if (_evas_gl_cocoa_window) evas_gl_common_context_flush(_evas_gl_cocoa_window->gl_context); - _evas_gl_cocoa_window = gw; + _evas_gl_cocoa_window = gw; } evas_gl_common_context_use(gw->gl_context); --
