Re: XForms: OpenGl canvas

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 12 May 98 09:19:51 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> Here I have the following problem with a glcanvas. The canvas is integrated
> inside the user interface and I want to display grey level images images
> in it.
> I have trouble to initialize the colormap.

I've put my mildly hacked version of gl.c in

ftp://ncmir.ucsd.edu/pub/xforms_hacks/gl.c

It has the color table mods as well as a couple of other modifications
which I found necessary or useful. First off, it handles finding an
appropriate Visual in a little different manner. Second, it adds
three new callback options: glcanvas_init_callback,
glcanvas_activate_callback, and glcanvas_cleanup_callback. The
callbacks may be called at init, activate, and cleanup, respectively.
The funcitons to set them are

void fl_set_glcanvas_init_callback( FL_OBJECT *ob,
void (*callback)( FL_OBJECT *ob ) )
void fl_set_glcanvas_activate_callback( FL_OBJECT *ob,
void (*callback)( FL_OBJECT *ob ) )
void fl_set_glcanvas_cleanup_callback( FL_OBJECT *ob,
void (*callback)( FL_OBJECT *ob ) )

and the function called is of the form

void glcanvas_callback( FL_OBJECT *ob )

[There probably should be a `void *data' parameter there but I didn't
have need for it at the time I added them].

Finally, error conditions are handled though a user supplied function,
abend() [yes, my old IBM mainframe roots are showing]. In this case,
it can be as simple as

void abend( char *message )

{

fprintf( stderr, "%s\n", message );
exit( 1 );

}

[my own private library version is somewhat more elaborate, taking
varargs arguments and acting more like fprintf()].

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/