GTK+2 vs. GTK+3 signal “expose/draw/render” events



Hello everyone and thanks for reading this,
You will find the same message posted on stackoverflow by following this link <http://stackoverflow.com/questions/39837159/gtk2-vs-gtk3-signal-expose-draw-render-events> (or pretty much the same), but I figured that the gtk mailing list was probably a better way to get the help I need. My name is Sébastien Le Roux, I am working on a program that offers a visualization interface for molecules,
atomic systems ... I have 3 different versions of my program:

 * (a) GTK2 + GtkGlext : works great !
 * (b) GTK3 + X11 : works just fine !
 * (c) GTK3 + GtkGLArea : does not work :-(

While I am still working on (c), I learned that the GtkGLArea is rather picky concerning the OpenGL commands, some things came up while I was trying to find out the origin of some behavior differences between (a) and (b). The OpenGL rendering is significantly slower in (b) than in (a), or I thought that was the case. If you check this link <http://stackoverflow.com/questions/39789414/how-to-get-as-many-information-as-possible-about-an-opengl-context> you will see that I got some help and manage to find out that GTK+ signals were not handled in the same way between GTK+2 (a) and GTK+3 (b), and (c) even if I only got a black screen in that case (but that is another issue), here is how I prepare(d) the GtkWidget(s) and the corresponding signals, note that I only present hereafter the GTK+ related commands:

 *

   (a)

   |GtkWidget*drawing_area =gtk_drawing_area_new ();g_signal_connect
   (G_OBJECT (drawing_area),"expose-event",G_CALLBACK(on_expose),data);|

 *

   (b)

   |GtkWidget*drawing_area =gtk_drawing_area_new ();g_signal_connect
   (G_OBJECT (drawing_area),"draw",G_CALLBACK(on_expose),data);|

 *

   (c)

   |GtkWidget*drawing_area =gtk_gl_area_new ();g_signal_connect
   (G_OBJECT (drawing_area),"render",G_CALLBACK(on_expose),data);|

Using the tool Apitrace I noticed in case (a) that each OpenGL frame was drawn once, while it was drawn 5 times in cases (b) and (c). Then just adding a basic counter in the callback I confirmed that for each "expose/draw/render" the signal was emitted (and thus the "drawing-area" was rendered that many times, for the same frame):

 * (a) : once
 * (b) : 5 times
 * (c) : 5 times

(a) is GTK+2, (b) and (c) are GTK+3 ... now my question will be rather obvious, but how can I changed or maybe should I say correct the GTK+3 version of my program to make it as smooth, on an OpenGL rendering point of view, as the GTK+2 version ?

Thanks in advance !

Sébastien Le Roux

--
===========================================================
Dr. Sébastien Le Roux
Ingénieur de Recherche CNRS
Institut de Physique et Chimie des Matériaux de Strasbourg
Département des Matériaux Organiques
23, rue du Loess
BP 43
F-67034 Strasbourg Cedex 2, France
E-mail: sebastien leroux ipcms unistra fr
Webpage: http://www-ipcms.u-strasbg.fr/spip.php?article1771
RINGS project: http://rings-code.sourceforge.net/
ISAACS project: http://isaacs.sourceforge.net/
Fax:   +33 3 88 10 72 46
Phone: +33 3 88 10 71 62
===========================================================



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