4 #include <gtkgl/gtkglarea.h>
5 #include <caml/mlvalues.h>
6 #include <caml/alloc.h>
7 #include <caml/memory.h>
8 #include <caml/callback.h>
15 #include "gtkgl_tags.h"
17 /* Conversion functions */
18 #include "gtkgl_tags.c"
20 #define GtkGLArea_val(val) ((GtkGLArea*)GtkObject_val(val))
22 value ml_gtk_gl_area_new (value list, value share)
28 for (len = 0, cursor = list; cursor != Val_unit; cursor = Field(cursor,1))
30 if (Is_block(Field(cursor,0))) len += 2;
34 attrs = (int*) stat_alloc ((len+1)*sizeof(int));
36 for (i = 0, cursor = list; cursor != Val_unit; cursor = Field(cursor,1))
38 value option = Field(cursor,0);
39 if (Is_block(option)) {
40 attrs[i++] = Visual_options_val(Field(option,0));
41 attrs[i++] = Int_val(Field(option,1));
43 else attrs[i++] = Visual_options_val(option);
45 attrs[i] = GDK_GL_NONE;
48 ((GtkObject*)gtk_gl_area_share_new(attrs,GtkGLArea_val(share)));
53 ML_1 (gtk_gl_area_make_current, GtkGLArea_val, Val_bool)
54 ML_1 (gtk_gl_area_swapbuffers, GtkGLArea_val, Unit)