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



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.

There are GLX functions, available through <GLX.h>, that will not be available on MS Windows. They must be replaced by the equivalent GLW functions provided
by OpenGL for MS Windows. I am not sure about OpenGL on MAC OS X, but it
should be similar.

Futurely, when Wayland arrives, some of these functions might need to be replaced
by their new equivalent ones.

Moreover, this code is specifically to render OpenGL on GTK drawing areas only. You can have an unlimited number of them, sharing resources such as pre-compiled lists, etc. This is what is needed in Engineering, Architecture, Chemistry, you name it.

GTKGLExt is designed to draw OpenGL on any GTK widget, which is totally different. As far as I understand, you could render a OpenGL context on a Button, a Progress Bar, a Text View, etc. This might be useful to create fancy GTK 3D themes, I really don't know...

A OpenGL drawable can be a window or a pixmap. In this code I always worked with windows only. I didn't check which changes would be needed for pixmaps. Again, I do not
expect serious issues here.

In short, this code works fine, is simple, but is a starting point, not a final solution
for everything (nothing is...).

I am not even claiming that this code is error free. Actually another good reason for showing this code is to encourage others to find better solutions, to fix errors, etc.

Carlos
http://www.gamgi.org/

I have been busy, but I will work on this, as quickly as I can, and I will post a clean proposal here (including example working code, as simple as possible, together with detailed explanations) so people can try it.

Regards,
Carlos
On Wed, Feb 12, 2014 at 12:37:15AM +0000, Carlos Pereira wrote:

      To bridge GTK and OpenGL we need the following six functions:

[:snip:]

      With these 6 functions, you can have an unlimited number of
      simultaneous OpenGL graphic areas, sharing pre-compiled lists,
      with all sorts of buffers and lights (exactly as with GtkGLExt).

[:snip:]

      all systems around, would be just a few hundred lines of code...
      that's all that is needed for GTK to support OpenGL... and after
      15 years we are still waiting for this...

I agree. If it is as good as you say, then what are we complaining about?
Send your patches to the gnome/gtk+ maintainers for inclusion in the
next release.  If they can't or won't include them, release it as a
project in its own right, and let us all enjoy.

J'




_______________________________________________
gtkglext-list mailing list
gtkglext-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkglext-list

_______________________________________________
gtkglext-list mailing list
gtkglext-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkglext-list




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