PreviousUp

11.5.4  Opengl Binding Internals

(This section is mainly intended for maintainers working on the Mythryl Opengl binding, not applications programmers interested only in using it.)

The Mythryl Opengl binding architecture is based upon a four-layer stack:

To reduce the bug count and improve ease of maintenance, as much as practical of the Opengl binding is mechanically generated from compact specifications.

The generating Mythryl script is src/opt/opengl/sh/make-opengl-glue.

The specification file is src/opt/opengl/etc/opengl-construction.plan.

The make-opengl-glue script is normally invoked as needed by the top-level make compiler command; it may also be manually invoked by doing make opengl-glue at the top level.

A typical opengl-construction.plan paragraph looks like

    fn-name  : set_table_col_spacing 
    opengl-code : gtk_table_set_col_spacing( GTK_TABLE(/*table*/w0), /*col*/i1, /*spacing*/i2) 
    type     : { session: Session, table: Widget, col: Int, spacing: Int } -> Void 
    run      : plain-fn 
    url      : http://library.gnome.org/devel/gtk/stable/GtkTable.html#gtk-table-set-col-spacing 

This is a fairly dense encoding whose details are more significant and critical than is immediately apparent:

In some cases the needed translation from the Mythryl application programmer call to the driver level call is too irregular to be conveniently synthesized according to the above protocol. In such cases the code is simply manually provided inline in the spec:

    fn-name  : set_minimum_widget_size 
    opengl-code : gtk_widget_set_size_request( GTK_WIDGET(/*widget*/w0), /*wide*/i1, /*high*/i2) 
    type     : (Session, Widget, (Int,Int)) -> Void 
    run      : plain-fn 
    url      : http://library.gnome.org/devel/gtk/stable/GtkWidget.html#gtk-widget-set-size-request 
    opengl-client-g.pkg:        fun set_minimum_widget_size (session: Session, widget, (wide, high)) 
    opengl-client-g.pkg:            = 
    opengl-client-g.pkg:            d::set_minimum_widget_size (session.subsession, widget, wide, high); 

Comments and suggestions to: bugs@mythryl.org

PreviousUp