beginnings of high-level modules
authorAndy Wingo <wingo@pobox.com>
Sun, 3 Feb 2013 18:39:30 +0000 (19:39 +0100)
committerAndy Wingo <wingo@pobox.com>
Sun, 3 Feb 2013 18:39:30 +0000 (19:39 +0100)
* Makefile.am: Add the new modules.
* figl/gl.scm:
* figl/glx.scm: Add high-level modules.  Nothing in them yet except a
  resolver.

Makefile.am
figl/gl.scm [new file with mode: 0644]
figl/glx.scm [new file with mode: 0644]

index 255d508..debe5b4 100644 (file)
@@ -10,10 +10,12 @@ SOURCES = \
        figl/runtime.scm \
        figl/gl/types.scm \
        figl/gl/low-level.scm \
+       figl/gl.scm \
        figl/glu/types.scm \
        figl/glu/low-level.scm \
        figl/glx/types.scm \
-       figl/glx/low-level.scm
+       figl/glx/low-level.scm \
+       figl/glx.scm
 
 update: figl/parse.go
        $(top_builddir)/env $(GUILE) $(top_srcdir)/maint/update-low-level-bindings
diff --git a/figl/gl.scm b/figl/gl.scm
new file mode 100644 (file)
index 0000000..94b5048
--- /dev/null
@@ -0,0 +1,27 @@
+;;; figl
+;;; Copyright (C) 2013 Andy Wingo <wingo@pobox.com>
+;;; 
+;;; Figl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;; 
+;;; Figl is distributed in the hope that it will be useful, but WITHOUT
+;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
+;;; Public License for more details.
+;;; 
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this program.  If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; OpenGL binding.
+;;
+;;; Code:
+
+(define-module (figl gl)
+  #:use-module (figl runtime)
+  #:use-module (figl gl low-level))
+
diff --git a/figl/glx.scm b/figl/glx.scm
new file mode 100644 (file)
index 0000000..81504dc
--- /dev/null
@@ -0,0 +1,41 @@
+;;; figl
+;;; Copyright (C) 2013 Andy Wingo <wingo@pobox.com>
+;;; 
+;;; Figl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;; 
+;;; Figl is distributed in the hope that it will be useful, but WITHOUT
+;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
+;;; Public License for more details.
+;;; 
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this program.  If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; OpenGL binding.
+;;
+;;; Code:
+
+(define-module (figl glx)
+  #:use-module (system foreign)
+  #:use-module (figl runtime)
+  #:use-module (figl glx low-level))
+
+(define libGL
+  (delay (dynamic-link "libGL")))
+
+(define glXGetProcAddress
+  (delay (pointer->procedure
+          '*
+          (dynamic-pointer "glXGetProcAddress" (force libGL))
+          '(*))))
+
+(define (glx-resolver name)
+  ((force glXGetProcAddress) (string->pointer name)))
+
+(current-resolver glx-resolver)