From: "Sung W. Park" <sungwoo@gmail.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 25 Apr 2011 08:41:36 +0000 (08:41 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 25 Apr 2011 08:41:36 +0000 (08:41 +0000)
commit6988d5cef450831f310aefaeba29f764b1bd494c
tree5a557277c1744907265d225f17c8d31b4f59f7e4
parent671e8156120a00bfcac7f05e267279473d4cd9fd
From: "Sung W. Park" <sungwoo@gmail.com>
Subject: [E-devel] [Review] [Patch] Evas - OpenGL on Evas: surface
texture creation patch

I'm attaching a patch that addresses the awkward usage case. It's something
that didn't bother me initially but the more I look at it, i think
it's a little off. :-)

The initial version of the evas_gl that I've submitted had the
following use case.

   evasgl = evas_gl_new(e);
   sfc = evas_gl_surface_create(...);
   ctx = evas_gl_context_create(...);

// Make current triggers surface texture and FBO to be created
   evas_gl_make_current(evasgl, sfc, ctx);

// Then you can do a surface_get to retrieve the proper texture and set it
   evas_gl_native_surface_get(evasgl, sfc, &ns);
   evas_object_image_native_surface_set(img_obj, &ns);

   The unnatural thing about this use case is that you have to call the make_current
one time in order for evas_gl to generate a surface texture.  This is because
you need a context to create a texture.  Unfortunately, this makes the usage
case really awkward.

So, instead, I've decided to get rid of the need for calling the make_current
by generating a surface texture when evas_gl_surface_create() is called
by using the evas' gl context.  This works because the newly created context
shares resources with evas.  in fact, this is what i'm currently doing with surface
deletion anyway so I thought this solution was reasonable.

Here's how it looks after you get rid of the make_current:

   evasgl = evas_gl_new(e);
   sfc = evas_gl_surface_create(...);
   ctx = evas_gl_context_create(...);

   evas_gl_native_surface_get(evasgl, sfc, &ns);
   evas_object_image_native_surface_set(img_obj, &ns);

The patch is pretty small and straightforward.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@58892 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
m4/evas_check_engine.m4
src/modules/engines/gl_x11/evas_engine.c