Next: , Previous: Package_Gtk.GEntry, Up: Top



Package Gtk.GLArea

This widget is derived from Gtk_Drawing_Area and provides an area where it is possible to use the openGL API.

Widget Hierarchy
     GObject                       (see Package_Glib.Object)
     Gtk_Object                    (see Package_Gtk.Object)
        \___ Gtk_Widget            (see Package_Gtk.Widget)
           \___ Gtk_Drawing_Area   (see Package_Gtk.Drawing_Area)
              \___ Gtk_GLArea      (see Package_Gtk.GLArea)
     

Types

type Attributes_Array is array (Natural range <>) of GL_Configs;

Note: as opposed to what exists in C, you don't need to have the last element in the array be GDK_GL_NONE. This is done transparently by GtkAda itself.


Subprograms
procedure Gtk_New (Widget : out Gtk_GLArea; Attr_List : in Attributes_Array);
Make an OpenGL widget, Attr_List is passed to glXChooseVisual GLX call.
Attr_List specifies a list of Boolean attributes and enum/integer attribute/value pairs. See glXChooseVisual man page for more explanation on Attr_List. Widget is created with visual and colormap of the requested type and GLX context is created for this widget. You can't do opengl calls on widget until it has X window. X window is not created until widget is realized.

procedure Gtk_New (Widget : out Gtk_GLArea; Attr_List : in Attributes_Array; Share : access Gtk_GLArea_Record'Class);
Same as above.
Share specifies the widget with which to share display lists and texture objects. A non initialized value indicates that no sharing is to take place.

function Make_Current (Glarea : access Gtk_GLArea_Record'Class) return Boolean;
Must be called before rendering into OpenGL widgets.
Return True if rendering to widget is possible. Rendering is not possible if widget is not Gtk_GLArea widget or widget is not realized.

procedure Swap_Buffers (Glarea : access Gtk_GLArea_Record'Class);
Promote contents of back buffer of Glarea to front buffer.
The contents of front buffer become undefined.