void
eng_window_use(Evas_GL_Glew_Window *gw)
{
   if (_evas_gl_glew_window != gw)
     {
        if (_evas_gl_glew_window)
          evas_gl_common_context_flush(_evas_gl_glew_window->gl_context);
        _evas_gl_glew_window = gw;
        wglMakeCurrent(gw->dc, gw->context);
     }
   evas_gl_common_context_use(gw->gl_context);
}
Esempio n. 2
0
void
eng_window_use(Evas_GL_Wl_Window *gw)
{
   Eina_Bool force_use = EINA_FALSE;

   if (_evas_gl_wl_window)
     {
        if ((eglGetCurrentContext() !=
             _evas_gl_wl_window->egl_context[0]) ||
            (eglGetCurrentSurface(EGL_READ) !=
                _evas_gl_wl_window->egl_surface[0]) ||
            (eglGetCurrentSurface(EGL_DRAW) !=
                _evas_gl_wl_window->egl_surface[0]))
           force_use = EINA_TRUE;
     }
   if ((_evas_gl_wl_window != gw) || (force_use))
     {
        if (_evas_gl_wl_window)
          {
             evas_gl_common_context_use(_evas_gl_wl_window->gl_context);
             evas_gl_common_context_flush(_evas_gl_wl_window->gl_context);
          }
        _evas_gl_wl_window = gw;
        if (gw)
          {
             // EGL / GLES
             if (gw->egl_surface[0] != EGL_NO_SURFACE)
               {
                  if (eglMakeCurrent(gw->egl_disp, gw->egl_surface[0],
                                     gw->egl_surface[0],
                                     gw->egl_context[0]) == EGL_FALSE)
                    {
                       ERR("eglMakeCurrent() failed!");
                    }
               }
          }
     }
   if (gw) evas_gl_common_context_use(gw->gl_context);
}