some infra for starting to handle dest-alpha (rgba) windows in gl engine.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 11 Oct 2009 06:59:47 +0000 (06:59 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 11 Oct 2009 06:59:47 +0000 (06:59 +0000)
not sure shaped windows will ever be sanely possible.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@43015 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

m4/evas_check_engine.m4
src/modules/engines/gl_common/evas_gl_context.c
src/modules/engines/gl_x11/evas_engine.h
src/modules/engines/gl_x11/evas_x_main.c

index fbc9dd9..52b482c 100644 (file)
@@ -154,13 +154,13 @@ if test "x${have_dep}" = "xyes" ; then
    evas_engine_gl_common_libs="-lGL -lpthread"
 else
    if test "x$2" = "xyes" ; then
-      x_libs="${x_libs} -lX11 -lXext"
+      x_libs="${x_libs} -lX11 -lXext -lXrender"
    else
       x_dir=${x_dir:-/usr/X11R6}
       x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
-      x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11"
+      x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
    fi
-   AC_CHECK_HEADERS([EGL/egl.h X11/X.h X11/Xlib.h], [have_egl="yes"])
+   AC_CHECK_HEADERS([EGL/egl.h X11/X.h X11/Xlib.h X11/extensions/Xrender.h], [have_egl="yes"])
    if test "x${have_egl}" = "xyes" ; then
       have_gles20="no"
       AC_CHECK_LIB(gles20, glTexImage2D, [have_gles20="yes"], , -lEGL)
index 330a10d..0074bb0 100644 (file)
@@ -86,7 +86,6 @@ evas_gl_common_context_new(void)
         glEnable(GL_DITHER);
         glDisable(GL_BLEND);
         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-// for dest alpha        
 //        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
         glDepthMask(GL_FALSE);
         
index f819808..99aca22 100644 (file)
@@ -12,6 +12,7 @@
 #   include <X11/Xlib.h>
 #   include <X11/Xatom.h>
 #   include <X11/Xutil.h>
+#   include <X11/extensions/Xrender.h>
 #  elif defined(GLES_VARIETY_SGX)
 #   define SUPPORT_X11 1
 #   include <EGL/egl.h>
 #   include <X11/Xlib.h>
 #   include <X11/Xatom.h>
 #   include <X11/Xutil.h>
+#   include <X11/extensions/Xrender.h>
 #  endif
 # else
 #  include <GL/glx.h>
 #  include <X11/Xlib.h>
 #  include <X11/Xatom.h>
 #  include <X11/Xutil.h>
+#  include <X11/extensions/Xrender.h>
 #  include <GL/gl.h>
 #  include <GL/glx.h>
 # endif
index 5571468..0535aa7 100644 (file)
@@ -198,18 +198,65 @@ eng_best_visual_get(Display *disp, int screen)
         XMatchVisualInfo(disp, screen, depth, TrueColor, _evas_gl_x11_vi);
 // GLX
 #else
-        int _evas_gl_x11_configuration[9] =
+
+#if 0 // use this if we want alpha
+        int config_attrs[20];
+        GLXFBConfig *configs = NULL, config = 0;
+        int i, num;
+        
+        config_attrs[0] = GLX_DRAWABLE_TYPE;
+        config_attrs[1] = GLX_WINDOW_BIT;
+        config_attrs[2] = GLX_DOUBLEBUFFER;
+        config_attrs[3] = 1;
+        config_attrs[4] = GLX_RED_SIZE;
+        config_attrs[5] = 1;
+        config_attrs[6] = GLX_GREEN_SIZE;
+        config_attrs[7] = 1;
+        config_attrs[8] = GLX_BLUE_SIZE;
+        config_attrs[9] = 1;
+        config_attrs[10] = None;
+        
+        // if rgba
+        config_attrs[10] = GLX_ALPHA_SIZE;
+        config_attrs[11] = 1;
+        config_attrs[12] = GLX_RENDER_TYPE;
+        config_attrs[13] = GLX_RGBA_BIT;
+        config_attrs[14] = None;
+        
+        configs = glXChooseFBConfig(disp, 0, config_attrs, &num);
+        for (i = 0; i < num; i++)
+          {
+             XVisualInfo *visinfo;
+             XRenderPictFormat *format;
+             
+             visinfo = glXGetVisualFromFBConfig(disp, configs[i]);
+             if (!visinfo) continue;
+             format = XRenderFindVisualFormat(disp, visinfo->visual);
+             if (!format) continue;
+             
+             if (format->direct.alphaMask > 0)
+               {
+                  config = configs[i];
+                  _evas_gl_x11_vi = visinfo;
+                  break;
+               }
+             XFree(visinfo);
+          }
+#else   
+        int _evas_gl_x11_configuration[] =
           {
              GLX_DOUBLEBUFFER,
                GLX_RGBA,
-               GLX_RED_SIZE,   1,
-               GLX_GREEN_SIZE, 1,
-               GLX_BLUE_SIZE,  1,
+               GLX_RED_SIZE, 1,
+               GLX_GREEN_SIZE,1,
+               GLX_BLUE_SIZE, 1,
                None
           };
         _evas_gl_x11_vi = glXChooseVisual(disp, screen,
                                           _evas_gl_x11_configuration);
 #endif
+        
+#endif
      }
    if (!_evas_gl_x11_vi) return NULL;
    return _evas_gl_x11_vi->visual;