> From: <cra...@gmx.net> > Date: Sat, 02 Nov 2013 20:27:45 +0100 > > Hello fellow Schemers! > > I'm playing around with OpenGL bindings in MIT/GNU Scheme.
There's a beginning libGL,libGLU wrapper in the Gtk branch in git://birchwood-abbey.net/~matt/mit-scheme.git At the moment it is just sufficient to run a glxgears demo. The demo and other GLX-related (Gtk-related) parts could be moved to a separate GLX subsystem. Then you wouldn't need Gtk to build and install it. You could use it with GLFW instead. > I'm using GLFW as the toolkit to access window-related functions. It > includes a function glfwSetKeyCallback, which [...] does not support > passing user-defined data. Is there any way to make this work > nonetheless? Sure. I haven't actually tried this, but you should be able to call glfwSetKeyCallback like this. (C-call "glfw_set_key_callback" window (C-callback "key_callback") (C-callback (lambda args (display ";key_callback\n")))) You will need declarations like this: (extern void glfw_set_key_callback (window (* GLFWwindow)) (CALLBACK (* GLFWkeyfun)) (ID int)) (callback void key_callback (window (* GLFWwindow)) (key int) ... (ID int)) And adapter code like this: static int key_callback_id; static void key_helper (GLFWwindow*, int, ...); void glfw_set_key_callback (GLFWwindow* window, GLFWkeyfun *callback, int user_data) { key_callback_id = user_data; glfwSetKeyCallback (window, &key_helper); } static void key_helper (GLFWwindow* window, int key, ...) { Scm_key_callback (window, key, ..., key_callback_id); } > Another thing that I found is that it seems impossible to load > multiple FFI-bindings in the same image. [...] Is there a way to > make this work? You will need to use the package system. You cannot (easily) C-include more than once per syntax-time environment. There are working blowfish, md5, mhash, and gdbm wrappers in master, with "check" Makefile targets for exercise. To see the seemingly impossible, get to your master clone's src/ directory and paste: cd blowfish/; autoconf; ./configure; make all check install cd ../md5; autoconf; ./configure; make all check install cd ../mhash; autoconf; ./configure; make all check install cd ../gdbm; make all check install cd ../; mit-scheme (let ((subsystems '("blowfish" "md5" "mhash"))) (load-option 'GDBM2) (for-each (lambda (s) (load-option (intern s))) subsystems) (load "gdbm/gdbm-check") (for-each (lambda (s) (load (string-append s"/"s"-check"))) subsystems)) You should see 4 different shims load and operate side-by-side in one "image" (world, band). If you see this ;Unbound variable: generate-shim you need to enter this first PATH=<bin-directory-containing-recent-master-binary>:$PATH `mit-scheme --version' should say "Release 9.1.99". _______________________________________________ MIT-Scheme-devel mailing list MIT-Scheme-devel@gnu.org https://lists.gnu.org/mailman/listinfo/mit-scheme-devel