Re: [GtkGLExt] gtk_opengl



Hi Ryan,

we had a long discussion about this just weeks ago, on the GTKGLExt mailling list (see below one of my posts describing a new version of the code you mention, including comments from Javier Jardon, who ported the code to GTK 3.0).

In my opinion, there is no excuse for GTK not supporting OpenGL, when this support requires less than one hundred lines of C code. Admittedly this is for X11 only, but for Windows it should not be that different...

Ideally GTK developers will include some improved version of this code (or equivalent) in the GTK main tree (hello Javier? John?)... Until that day arrives, just use it directly on your app...

Carlos
On 03/23/2014 11:17 PM, Ryan Danbrook wrote:
Hi,

I came across a mailing list post you made years ago:
https://mail.gnome.org/archives/gtk-app-devel-list/2010-March/msg00023.html

I downloaded gtk_opengl.tar.gz and was pleased to find it has been updated
very recently, with compatibility for GTK+ 3.

I just wanted to say thank you for doing this. I've been looking for a way
to render OpenGL to a GtkDrawingArea for months now, and this helped me
solve my problem. This is a problem a lot of other people are having as
well (especially in the SDL community, since it is no longer possible to
easily render SDL graphical output to a widget). I think you should
consider making gtk_opengl a more public project, I'm sure there are other
people out there who would appreciate it as well.

It's funny how our projects are completely different, but have similar
problems to solve. My project is an NES emulator.

Thanks,
Ryan

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]