[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[E-devel] Evas GL engine patch


The GL engine of Evas has an annoying bug when you want to create
several windows using this engine: when you create or resize a window,
all the other windows already created are not redrawn correcly, only
the last created/resized window has no problem. I've attached a
shot that shows what happens when you create a new window while there
is an existing window that already uses the GL engine. Please have a
look at it if you want to understand the problem.

So, in this example, the "Etk Test Application" is created first,
and when the "Entry" button is clicked, the "Etk Entry Test" window is
created. You can see that the "Etk Test Application" is no longer
rendered correctly. Actually, only the part of the window that is
inside the red rectangle (added with the Gimp) is correctly refreshed,
the other part of the window does not refresh anymore. You can also
notice that the red rectangle has exactly the same size as the "Etk
Entry Test" window.

In fact, the problem is that when you create/resize a window,
_evas_gl_common_viewport_set() is called, and this function changes the
GL viewport and the view matrices. The thing is, these changes affect
all the windows, not only the created/resized window. A way to fix that
would be to call _evas_gl_common_viewport_set() each time a window is
rendered, before the rendering process begins (at the start of the
function evas_render_updates_internal() for example). Only thing, I
can't see a function that is called at the start of the rendering
process in the engine API (something like pre_render()).

I've written a small patch that calls _evas_gl_common_viewport_set() in
the eng_output_redraws_rect_add() method of the gl_x11 engine (because
this method is called at the start of the rendering process) just as a
proof that it could fix the bug, but this is definitely not the place
to put this code. The patch is attached.

Please tell me what you think.

Simon TRENY <MoOm>

Attachment: gl_bug.png
Description: PNG image

Index: gl_common/evas_gl_context.c
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_context.c,v
retrieving revision 1.3
diff -u -r1.3 evas_gl_context.c
--- gl_common/evas_gl_context.c	6 Dec 2006 14:58:00 -0000	1.3
+++ gl_common/evas_gl_context.c	10 Dec 2006 10:26:48 -0000
@@ -97,7 +97,7 @@
 evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h)
-   if ((gc->w == w) && (gc->h == h)) return;
+   //if ((gc->w == w) && (gc->h == h)) return;
    gc->change.size = 1;
    gc->w = w;
    gc->h = h;
Index: gl_x11/evas_engine.c
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_x11/evas_engine.c,v
retrieving revision 1.17
diff -u -r1.17 evas_engine.c
--- gl_x11/evas_engine.c	9 Dec 2006 08:52:08 -0000	1.17
+++ gl_x11/evas_engine.c	10 Dec 2006 10:26:49 -0000
@@ -150,6 +150,7 @@
    Render_Engine *re;
    re = (Render_Engine *)data;
+   evas_gl_common_context_resize(re->win->gl_context, re->win->w, re->win->h);
    /* smple bounding box */
    if (!re->win->draw.redraw)