From a60f577446d01bc1e8db7142721d252f2d6a2dbd Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sun, 11 Oct 2009 06:59:47 +0000 Subject: [PATCH] some infra for starting to handle dest-alpha (rgba) windows in gl engine. not sure shaped windows will ever be sanely possible. SVN revision: 43015 --- legacy/evas/m4/evas_check_engine.m4 | 6 +- .../engines/gl_common/evas_gl_context.c | 1 - .../src/modules/engines/gl_x11/evas_engine.h | 3 + .../src/modules/engines/gl_x11/evas_x_main.c | 55 +++++++++++++++++-- 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/legacy/evas/m4/evas_check_engine.m4 b/legacy/evas/m4/evas_check_engine.m4 index fbc9dd98aa..52b482ce7c 100644 --- a/legacy/evas/m4/evas_check_engine.m4 +++ b/legacy/evas/m4/evas_check_engine.m4 @@ -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) diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c index 330a10dafa..0074bb016c 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c @@ -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); diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_engine.h b/legacy/evas/src/modules/engines/gl_x11/evas_engine.h index f81980813e..99aca22c47 100644 --- a/legacy/evas/src/modules/engines/gl_x11/evas_engine.h +++ b/legacy/evas/src/modules/engines/gl_x11/evas_engine.h @@ -12,6 +12,7 @@ # include # include # include +# include # elif defined(GLES_VARIETY_SGX) # define SUPPORT_X11 1 # include @@ -19,12 +20,14 @@ # include # include # include +# include # endif # else # include # include # include # include +# include # include # include # endif diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c b/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c index 5571468d5b..0535aa749b 100644 --- a/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c +++ b/legacy/evas/src/modules/engines/gl_x11/evas_x_main.c @@ -198,17 +198,64 @@ 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;