X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Flablgtk%2Flablgtk_20000829-0.1.0%2Fml_gtkgl.c;fp=helm%2FDEVEL%2Flablgtk%2Flablgtk_20000829-0.1.0%2Fml_gtkgl.c;h=5e0efd718c1cb90b9eda1052fd1d67e2fb883d1a;hb=2ee84a2a641938988703e329aef9fc3c5eb5aacf;hp=0000000000000000000000000000000000000000;hpb=34d83812af9b7064cc8f735c2a78169881140010;p=helm.git diff --git a/helm/DEVEL/lablgtk/lablgtk_20000829-0.1.0/ml_gtkgl.c b/helm/DEVEL/lablgtk/lablgtk_20000829-0.1.0/ml_gtkgl.c new file mode 100644 index 000000000..5e0efd718 --- /dev/null +++ b/helm/DEVEL/lablgtk/lablgtk_20000829-0.1.0/ml_gtkgl.c @@ -0,0 +1,54 @@ +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include + +#include "wrappers.h" +#include "ml_glib.h" +#include "ml_gdk.h" +#include "ml_gtk.h" +#include "gtkgl_tags.h" + +/* Conversion functions */ +#include "gtkgl_tags.c" + +#define GtkGLArea_val(val) ((GtkGLArea*)GtkObject_val(val)) + +value ml_gtk_gl_area_new (value list, value share) +{ + value cursor, res; + int len, i; + int *attrs; + + for (len = 0, cursor = list; cursor != Val_unit; cursor = Field(cursor,1)) + { + if (Is_block(Field(cursor,0))) len += 2; + else len++; + } + + attrs = (int*) stat_alloc ((len+1)*sizeof(int)); + + for (i = 0, cursor = list; cursor != Val_unit; cursor = Field(cursor,1)) + { + value option = Field(cursor,0); + if (Is_block(option)) { + attrs[i++] = Visual_options_val(Field(option,0)); + attrs[i++] = Int_val(Field(option,1)); + } + else attrs[i++] = Visual_options_val(option); + } + attrs[i] = GDK_GL_NONE; + + res = Val_GtkObject + ((GtkObject*)gtk_gl_area_share_new(attrs,GtkGLArea_val(share))); + stat_free(attrs); + return res; +} + +ML_1 (gtk_gl_area_make_current, GtkGLArea_val, Val_bool) +ML_1 (gtk_gl_area_swapbuffers, GtkGLArea_val, Unit)