and now REALLY fix that viewport bug...
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 6 Apr 2011 10:11:01 +0000 (10:11 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 6 Apr 2011 10:11:01 +0000 (10:11 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@58386 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/gl_common/evas_gl_context.c
src/modules/engines/gl_x11/evas_engine.c
src/modules/engines/gl_x11/evas_x_main.c

index c28d836..8fdbc7a 100644 (file)
@@ -848,7 +848,7 @@ evas_gl_common_context_use(Evas_Engine_GL_Context *gc)
 {
    if (_evas_gl_common_context == gc) return;
    _evas_gl_common_context = gc;
-   _evas_gl_common_viewport_set(gc);
+   if (gc) _evas_gl_common_viewport_set(gc);
 }
 
 void
index ae4c303..cfd35ae 100644 (file)
@@ -423,6 +423,7 @@ eng_setup(Evas *e, void *in)
                                            re->info->indirect,
                                            re->info->info.destination_alpha,
                                            re->info->info.rotation);
+                  eng_window_use(re->win);
                   if (re->win) gl_wins++;
                   if ((re->win) && (inc))
                      re->win->gl_context->references--;
index acdc26b..24e2fa6 100644 (file)
@@ -214,7 +214,6 @@ eng_window_new(Display *disp,
        eng_window_free(gw);
         return NULL;
      }
-    _evas_gl_x11_window = gw;
 
    vendor = glGetString(GL_VENDOR);
    renderer = glGetString(GL_RENDERER);
@@ -500,7 +499,6 @@ eng_window_new(Display *disp,
           }
      }
 #endif
-   _evas_gl_x11_window = gw;
    
    gw->gl_context = evas_gl_common_context_new();
    if (!gw->gl_context)
@@ -511,7 +509,7 @@ eng_window_new(Display *disp,
 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
    gw->gl_context->egldisp = gw->egl_disp;
 #endif   
-   evas_gl_common_context_use(gw->gl_context);
+   eng_window_use(gw);
    evas_gl_common_context_resize(gw->gl_context, w, h, rot);
    gw->surf = 1;
    return gw;
@@ -525,13 +523,13 @@ eng_window_free(Evas_GL_X11_Window *gw)
    eng_window_use(gw);
    if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL;
    if (gw->gl_context)
-      {
-         ref = gw->gl_context->references - 1;
-         evas_gl_common_context_free(gw->gl_context);
-      }
+     {
+        ref = gw->gl_context->references - 1;
+        evas_gl_common_context_free(gw->gl_context);
+     }
 #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
    if (gw->egl_surface[0] != EGL_NO_SURFACE)
-     eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
+      eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
    if (ref == 0)
      {
         if (context) eglDestroyContext(gw->egl_disp, context);
@@ -539,7 +537,6 @@ eng_window_free(Evas_GL_X11_Window *gw)
         context = EGL_NO_CONTEXT;
      }
    eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-   evas_gl_common_context_use(NULL);
 #else
    if (gw->glxwin) glXDestroyWindow(gw->disp, gw->glxwin);
    if (ref == 0)
@@ -581,7 +578,10 @@ eng_window_use(Evas_GL_X11_Window *gw)
    if ((_evas_gl_x11_window != gw) || (force_use))
      {
         if (_evas_gl_x11_window)
-          evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
+          {
+             evas_gl_common_context_use(_evas_gl_x11_window->gl_context);
+             evas_gl_common_context_flush(_evas_gl_x11_window->gl_context);
+          }
        _evas_gl_x11_window = gw;
        if (gw)
          {
@@ -637,7 +637,6 @@ eng_window_unsurf(Evas_GL_X11_Window *gw)
            eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
         gw->egl_surface[0] = EGL_NO_SURFACE;
         _evas_gl_x11_window = NULL;
-        evas_gl_common_context_use(NULL);
      }
 #else
    if (gw->glxwin)