What about a GtkGlCanvas widget ? (Re: ANNOUNCE: GtkGLExt 0.3.0)
- From: Martin Quinson <Martin Quinson tuxfamily org>
- To: Naofumi Yasufuku <naofumi yasufuku net>
- Cc: gnome-hackers gnome org
- Subject: What about a GtkGlCanvas widget ? (Re: ANNOUNCE: GtkGLExt 0.3.0)
- Date: Sun, 23 Jun 2002 13:54:14 +0200
Hello, I've been playing a bit with gtkgkext, and I like it very much.
Still, I think it's too low level (as GL is). I dream of a GtkGlCanvas
widget a generic engine to draw structured graphics in GL like the gnome one
for 2D.
I think we should have 3 distinct hierarchies of objects, interacting with
each other:
GtkGlCanvas: Contains objects. It's the world. It's not even a visual widget.
GtkGlCamera: Is a view of the world. This widget is gl-enabled.
GtkGlItem: Something we put on the canvas.
Here is a snipet of how you could you use it:
canvas = gtk_gl_canvas_new(gtkglconfig);
item = gtk_gl_item_lw_new_from_file(canvas,filename);
camera1 = gtk_gl_camera_new(canvas,init_function);
camera2 = gtk_gl_camera_new(canvas,init_function);
camera3 = gtk_gl_camera_new(canvas,init_function);
gtk_gl_camera_set(camera1, "x", 0, "y", 0, "z", 10, "rho", 60, NULL);
gtk_gl_camera_set(camera2, "x", 40, "y", -50, "z", 10, "theta", 60, NULL);
gtk_gl_camera_set(camera3, "x", 120, "y", 0, "z", -150, NULL);
gtk_box_pack_start (GTK_WINDOW (vbox), camera1, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_WINDOW (vbox), camera2, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_WINDOW (vbox), camera3, TRUE, TRUE, 0);
gtk_widget_show(camera1);
gtk_widget_show(camera2);
gtk_widget_show(camera3);
gtk_widget_show(vbox);
for (i=0; i<500; i++) {
gtk_gl_item_move(item, "x", i, "y", 500-i, "rho", i%90, NULL);
}
I'm not sure you'll need to have several subtypes of both GtkGlCanvas or
GtkGlCamera, but GtkGlItem could be derivated, of course. I think of sphere,
cube, cylindre, or even lw_obj (like in my example), or 3DS, all of them
being child of the base item type.
Having a navigator would be as easy as attaching a preexisting function to
the camera signals "button_click" "button1_move" "button2_move"
"button3_move"...
I think this all would really ease the programming of the few gtkglarea
program I've found out there.
Don't get me wrong this mail is in between a feature request and a
description of what I plan to implement. I have really no experience in GL
programming, and very few in gtk/gnome programming (but I'm quite fluent in
C). This is what I would love to have in order to make gl rendering easily,
but I'm not sure I'll have the time and the motivation to actually implement
it.
I'm actually at try to implement it, borowing most of the code from the
lightspeed project, which already implement it more or less. I've no idea if
I'll success in it...
Thanks for your attention, Mt.
On Thu, Jun 20, 2002 at 01:42:38PM +0900, Naofumi Yasufuku wrote:
> Hello everyone,
>
> GtkGLExt, OpenGL extention to GTK, version 0.3.0 is released.
>
> http://sourceforge.net/projects/gtkglext/
>
> This release includes the important API changes.
> The new interface is designed to be suitable for GTK+/GDK API manner.
>
> * You can draw OpenGL scene using gdk_gl_drawable_* functions.
> For example,
>
> gboolean
> draw_gl_scene (GtkWidget *widget,
> GdkEventExpose *event,
> gpointer data)
> {
> GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
> GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
>
> gdk_gl_drawable_gl_begin (gldrawable, glcontext);
>
> /* GL calls */
>
> if (gdk_gl_drawable_is_double_buffered (gldrawable))
> gdk_gl_drawable_swap_buffers (gldrawable);
> else
> glFlush ();
>
> gdk_gl_drawable_gl_end (gldrawable);
>
> return TRUE;
> }
>
> It can also reduce waste quark data lookups.
>
> * Bitmap font support have been rewritten to be based on Pango.
> GdkFont is deprecated in GTK 2, and so gdk_gl_font_use_gdk_font ()
> is gone. Now, you can use gdk_gl_font_use_pango_font () and Pango
> API to use bitmap font in OpenGL.
>
> And then, all sources have been cleaned. Now, they include no
> deprecated code, and are fully compliant with GTK 2.
>
> Could you please try it and tell me your comments?
>
>
> General Information
> ===================
>
> GtkGLExt is an OpenGL extention to GTK 2.0 or later.
>
> This package is composed of GdkGLExt library and GtkGLExt library.
> GdkGLExt library includes low-level OpenGL related objects,
> GdkGLConfig, GdkGLContext, GdkGLDrawable, GdkGLWindow, and so on,
> which has GLX like interface. GtkGLExt library includes high-level
> gtk_widget API extentions using GdkGLExt, which extends *ANY* GTK+ widget
> to an OpenGL-capable widget.
>
> The objects included in these libraries are implemented using C and
> fully compliant with GLib's GObject and it's latest features.
>
> The official web site is:
> http://gtkglext.sourceforge.net/
>
> The official download & development information site is:
> http://sourceforge.net/projects/gtkglext/
>
>
> Supported Platforms
> ===================
>
> Currently GtkGLExt supports
>
> * UNIX platforms
> Tested on Linux (RedHat 7.3) and IRIX (6.5).
>
> * Win32 platforms
> Tested on Windows XP & 2000 Professional using MinGW/Cygwin
> environment.
>
>
> Thank you,
>
> --
> Naofumi Yasufuku <naofumi users sourceforge net>
> "The best way to predict the future is to invent it." -- Alan Kay
> _______________________________________________
> gnome-announce-list mailing list
> gnome-announce-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-announce-list
--
Of course Pacman didn't influence us as kids. If it did, we'd be running
around in darkened rooms, popping pills and listening to repetitive music.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]