Re: [GtkGLExt] Fwd: Re: GtkGlExt & GTK3



I noticed that with my new 2104 code, when I have two OpenGL graphic areas, and one is removed (so GTK does not leave the infinite loop in gtk_main), the following line of code causes problems (this problem does not occur in the examples or in my earlier code where I only freed the xcolormap and unrefed the colormap):

g_object_unref (G_OBJECT (visual));

So I remove this line from gtk_opengl_remove, and I added the following comment to gtk_opengl_create() and gtk_opengl_remove(), to raise attention to this issue:

QUESTION: to prevent memory leaks, do we
need to free something more on this function?

The address is the same as before:
http://www.gamgi.org/gtk_opengl.tar.gz

C



Hello everyone, hi Javier, hi John,

I prepared a new edition of this code:
http://www.gamgi.org/gtk_opengl.tar.gz

The (minor) differences are:

1) added a fourth parameter to gtk_opengl_create (direct rendering or rendering through X);

2) back ported to GTK 2 the colormap simplication that Javier introduced in the GTK 3 version. The only difference between GTK2 and GTK3 versions of gtk_opengl.c is now this (occurring in several functions):

GTK 2:
Display *xdisplay = gdk_x11_drawable_get_xdisplay (drawable);

GTK 3:
GdkDisplay *display = gdk_window_get_display (drawable);
Display *xdisplay = gdk_x11_display_get_xdisplay (display);

3) Added legal notices (this is a overkill but I am trying to make life as simple as possible for everyone): The version for GTK 3 is distributed under the licenses simplified BSD or LGPL (users choose). The version for GTK 2 is distributed under the simplified BSD. The rationale is: the GTK team might prefer the LGPL but BSD can be used everywhere, including closed source. The simplified BSD is the simplest license I could find (the OpenBSD license). The CC0 seems slightly more complex...

4) Javier, I added your name to the copyright notice, as you gave a very significant contribution to make this code useful.

5) Everything else are cosmetic changes: updated comments, variable names, order of functions

6) As a result this new tarball has the following directories (just ignore those you don't want):

gtk3_bsd/
gtk3_lgpl/
gtk2_bsd/
gtk2_glext/

This is also explained in the README.

Regards,
Carlos
On 23 February 2014 23:49, Carlos Pereira
<jose carlos pereira ist utl pt>  wrote:
Sorry for the delay, here is the code I prepared (it contains all
the functions needed to run OpenGL on a GTK drawing area):

http://www.gamgi.org/gtk_opengl.tar.gz
or:
http://www.gamgi.ist.utl.pt/gtk_opengl.tar.gz

The code is in a single file, gtk_opengl.c, very easy to read, I think.
It has 189 lines of C code only, a good part of it are comments and space
lines...

I included a directory with two classic examples, distributed by all
GtkGLArea and GtkGLExt releases, to show how this code works.

I included other directory with the same two examples, this time
using GtKGLExt, to make it simpler to compare the two approaches.

The code comes with README files and comments, with the most relevant
information. A variation of this code has been used since 2010 in a
relatively
large package without known problems.

I want to make it clear that I wrote this code for GTK 2 and the X Window
System.
There are a few gdk_x11_* functions, included through<gdk/gdkx.h>, that
might be handled differently on GTK 3. These changes, if needed, *should* be
trivial.
I was curious about this and I ported your "library" and examples to
GTK+3 (basically all the content of the home_made folder)
On my testing everything compiles and works perfectly fine :)
Ive uploaded the code to this repository [1] in case you (or anyone)
are interested

Regards and thanks for your work!

[1] https://gitorious.org/gtkopengl/gtkopengl/source/master:




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