Re: [GtkGLExt] What about GTK+-3.0 support?
- From: Carlos Pereira <jose carlos pereira ist utl pt>
- To: Lukas Kontenis <dse ssd gmail com>
- Cc: fermut gmail com, gtkglext-list gnome org
- Subject: Re: [GtkGLExt] What about GTK+-3.0 support?
- Date: Mon, 27 Jun 2011 15:53:04 +0100
The tarball below contains two .c files, gtkgl.c and glx.c, plus simple
makefiles make_gtkgl and make_glx (you might need to change a few
library paths in these makefiles to fit your case, all very simple), one
using GTKGLEXT, the other using GLX only. In both cases a OpenGL white
triangle is rendered on a GTK window. This example is designed to be as
simple as possible, to emphasize the differences between both methods.
http://www.gamgi.org/gtk_opengl.tar.gz
You are supposed to compile and clean them, the usual way:
make -f make_glx
make clean -f make_glx
and
make -f make_gtkgl
make clean -f make_gtkgl
The main task is to create a GLXContext:
area = gtk_drawing_area_new ();
gtk_widget_set_double_buffered (area, FALSE);
display = gdk_x11_get_default_xdisplay ();
xscreen = DefaultScreen (display);
screen = gdk_screen_get_default ();
xvisual = glXChooseVisual (display, xscreen, attributes);
visual = gdk_x11_screen_lookup_visual (screen, xvisual->visualid);
root = RootWindow (display, xscreen);
xcolormap = XCreateColormap (display, root, xvisual->visual, AllocNone);
colormap = gdk_x11_colormap_foreign_new (visual, xcolormap);
gtk_widget_set_colormap (area, colormap);
context = glXCreateContext (display, xvisual, NULL, TRUE);
free (xvisual);
and then, everytime you need to issue OpenGL commands:
window = gtk_widget_get_window (widget);
display = gdk_x11_drawable_get_xdisplay (window);
id = gdk_x11_drawable_get_xid (window);
if (glXMakeCurrent (display, id, context) == TRUE)
{
...
OpenGL code here
...
}
My app supports an unlimited number of OpenGL graphic areas working
simultaneously, with pre-compiled shared lists. Users can create and
remove these OpenGL graphic areas on the fly, so I need to ensure that
the GL context used to create a new OpenGL area is a valid one!
(initially I was using the context of the first GL area. After this GL
area was removed by the user, new areas would not share lists anymore...).
You can find here tarballs of my app, with and without GTKGLExt library:
http://www.gamgi.org/src/download.html
To see the differences between the two versions, just do something as:
diff -r version_with_gtkglext/src version_without_gtkglext/src
I worked on this more than one year ago, so I forgot most details (and I
am not
a X Window system expert!). Anyway if someone needs help please let
know. If someone
can contribute with improvements I would be delighted!
Regards,
Carlos Pereira
Please do post Your code or giva a link, I for one would like to see it.
Regards,
Lukas
On Sun, Jun 26, 2011 at 5:41 AM, Carlos Pereira<
jose carlos pereira ist utl pt> wrote:
I would like very much to know the answer to this question myself...
Anyway, it might be interesting for you to know that 30-40 lines of C code
is all you need to bridge GTK with OpenGL without GTKGLExt library at all.
This requires the X Window System, so to work in Windows it needs some
changes, not much I guess. If you are interested, please let me know.
Currently I maintain two versions of my app, one with and other without
GtKGLExt. I do this to feel safer, because I really don't know how the GTK
folks are going to change GTK rendering and Cairo in the future... perhaps
my code will break...?
Regards,
Carlos
Hello,
Is it possible to have some informations about an eventually GTK+-3.0
support?
In fact, I want to modify an application in order to support GTK+-3.0
but I don't know what can I do because this application uses gtkglext
and it seems this library doesn't support GTK+-3.0 (yet).
( http://live.gnome.org/**ProjectRidley<http://live.gnome.org/ProjectRidley>)
Do you know if there is any plans about this support of GTK+-3.0? Or
about en eventually merge of GtkGLExt in GTK+? Or a new project?
Thank you for your work and your help!
Matt
______________________________**_________________
gtkglext-list mailing list
gtkglext-list gnome org
http://mail.gnome.org/mailman/**listinfo/gtkglext-list<http://mail.gnome.org/mailman/listinfo/gtkglext-list>
______________________________**_________________
gtkglext-list mailing list
gtkglext-list gnome org
http://mail.gnome.org/mailman/**listinfo/gtkglext-list<http://mail.gnome.org/mailman/listinfo/gtkglext-list>
_______________________________________________
gtkglext-list mailing list
gtkglext-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkglext-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]