create stub of glut enums
authorDaniel Hartwig <mandyke@gmail.com>
Fri, 8 Feb 2013 11:29:29 +0000 (19:29 +0800)
committerDaniel Hartwig <mandyke@gmail.com>
Fri, 8 Feb 2013 11:29:29 +0000 (19:29 +0800)
* figl/glut/enums.spec: New file.

* examples/glut/demo.scm: Use glut enums.  Use clear-buffer-mask, not
  attrib-mask, now that it is correctly picked up as a bitfield.

* Makefile.am: Update.

Makefile.am
examples/glut/demo.scm
figl/glut/enums.scm [new file with mode: 0644]

index 09c9552..ac513a4 100644 (file)
@@ -28,6 +28,7 @@ SOURCES = \
        \
        figl/glut/runtime.scm \
        figl/glut/low-level.scm \
+       figl/glut/enums.scm \
        figl/glut.scm
 
 update: figl/parse.go
index c634214..1e62e8a 100644 (file)
@@ -1,27 +1,15 @@
 #!/usr/bin/env guile
 !#
 
-(use-modules (figl glut low-level)
+(use-modules (figl glut enums)
+             (figl glut low-level)
              (figl glut)
              (figl gl enums)
              (figl gl low-level)
              (system foreign))
 
-(define GLUT_RGB #x0000)
-(define GLUT_RGBA #x0000)
-(define GLUT_INDEX #x0001)
-(define GLUT_SINGLE #x0000)
-(define GLUT_DOUBLE #x0002)
-(define GLUT_ACCUM #x0004)
-(define GLUT_ALPHA #x0008)
-(define GLUT_DEPTH #x0010)
-(define GLUT_STENCIL #x0020)
-(define GLUT_MULTISAMPLE #x0080)
-(define GLUT_STEREO #x0100)
-(define GLUT_LUMINANCE #x0200)
-
 (define (render-scene)
-  (glClear (attrib-mask color-buffer depth-buffer))
+  (glClear (clear-buffer-mask color-buffer depth-buffer))
   (glBegin (begin-mode triangles))
   (glVertex3f -0.5 -0.5 0.0)
   (glVertex3f 0.5 0.0 0.0)
@@ -31,7 +19,7 @@
   (glutSwapBuffers))
 
 (glutInitWindowSize 320 200)
-(glutInitDisplayMode (logior GLUT_RGB GLUT_DOUBLE GLUT_DEPTH))
+(glutInitDisplayMode (display-mode rgb double depth))
 
 (glut-init (program-arguments))
 
diff --git a/figl/glut/enums.scm b/figl/glut/enums.scm
new file mode 100644 (file)
index 0000000..def8347
--- /dev/null
@@ -0,0 +1,41 @@
+;;; fgil
+;;; Copyright (C) 2013 Daniel Hartwig <mandyke@gmail.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:
+;;
+;; figl is the Foreign Interface to GL.
+;;
+;;; Code:
+
+(define-module (figl glut enums)
+  #:use-module (figl runtime)
+  #:export (display-mode))
+
+(define-bitfield
+  display-mode
+  (rgb #x0000)
+  (rgba #x0000)
+  (index #x0001)
+  (single #x0000)
+  (double #x0002)
+  (accum #x0004)
+  (alpha #x0008)
+  (depth #x0010)
+  (stencil #x0020)
+  (multisample #x0080)
+  (stereo #x0100)
+  (luminance #x0200))