]> git.jsancho.org Git - gacela.git/blob - src/gacela_GL.c
(no commit message)
[gacela.git] / src / gacela_GL.c
1 /* Gacela, a GNU Guile extension for fast games development
2    Copyright (C) 2009 by Javier Sancho Fernandez <jsf at jsancho dot org>
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include <libguile.h>
19 #include <GL/gl.h>
20 #include <GL/glu.h>
21 #include "gacela_GL.h"
22
23 SCM
24 gacela_glBegin (SCM mode)
25 {
26   glBegin (scm_to_int (mode));
27   return SCM_UNSPECIFIED;
28 }
29
30
31 void*
32 GL_register_functions (void* data)
33 {
34   // Data types
35   scm_c_define ("GL_UNSIGNED_BYTE", scm_from_int (GL_UNSIGNED_BYTE));
36
37   // Primitives
38   scm_c_define ("GL_POINTS", scm_from_int (GL_POINTS));
39   scm_c_define ("GL_LINES", scm_from_int (GL_LINES));
40   scm_c_define ("GL_LINE_LOOP", scm_from_int (GL_LINE_LOOP));
41   scm_c_define ("GL_LINE_STRIP", scm_from_int (GL_LINE_STRIP));
42   scm_c_define ("GL_TRIANGLES", scm_from_int (GL_TRIANGLES));
43   scm_c_define ("GL_TRIANGLE_STRIP", scm_from_int (GL_TRIANGLE_STRIP));
44   scm_c_define ("GL_TRIANGLE_FAN", scm_from_int (GL_TRIANGLE_FAN));
45   scm_c_define ("GL_QUADS", scm_from_int (GL_QUADS));
46   scm_c_define ("GL_QUAD_STRIP", scm_from_int (GL_QUAD_STRIP));
47   scm_c_define ("GL_POLYGON", scm_from_int (GL_POLYGON));
48
49   // Matrix Mode
50   scm_c_define ("GL_MODELVIEW", scm_from_int (GL_MODELVIEW));
51   scm_c_define ("GL_PROJECTION", scm_from_int (GL_PROJECTION));
52
53   // Depth buffer
54   scm_c_define ("GL_LEQUAL", scm_from_int (GL_LEQUAL));
55   scm_c_define ("GL_DEPTH_TEST", scm_from_int (GL_DEPTH_TEST));
56
57   // Lighting
58   scm_c_define ("GL_LIGHTING", scm_from_int (GL_LIGHTING));
59   scm_c_define ("GL_LIGHT1", scm_from_int (GL_LIGHT1));
60   scm_c_define ("GL_AMBIENT", scm_from_int (GL_AMBIENT));
61   scm_c_define ("GL_DIFFUSE", scm_from_int (GL_DIFFUSE));
62   scm_c_define ("GL_POSITION", scm_from_int (GL_POSITION));
63   scm_c_define ("GL_SMOOTH", scm_from_int (GL_SMOOTH));
64
65   // Blending
66   scm_c_define ("GL_BLEND", scm_from_int (GL_BLEND));
67   scm_c_define ("GL_ONE", scm_from_int (GL_ONE));
68   scm_c_define ("GL_SRC_ALPHA", scm_from_int (GL_SRC_ALPHA));
69
70   // Fog
71   scm_c_define ("GL_LINEAR", scm_from_int (GL_LINEAR));
72
73   // Buffers, Pixel Drawing/Reading
74   scm_c_define ("GL_RGB", scm_from_int (GL_RGB));
75   scm_c_define ("GL_RGBA", scm_from_int (GL_RGBA));
76
77   // Hints
78   scm_c_define ("GL_PERSPECTIVE_CORRECTION_HINT", scm_from_int (GL_PERSPECTIVE_CORRECTION_HINT));
79   scm_c_define ("GL_NICEST", scm_from_int (GL_NICEST));
80
81   // Texture mapping
82   scm_c_define ("GL_TEXTURE_2D", scm_from_int (GL_TEXTURE_2D));
83   scm_c_define ("GL_TEXTURE_MAG_FILTER", scm_from_int (GL_TEXTURE_MAG_FILTER));
84   scm_c_define ("GL_TEXTURE_MIN_FILTER", scm_from_int (GL_TEXTURE_MIN_FILTER));
85   scm_c_define ("GL_LINEAR_MIPMAP_NEAREST", scm_from_int (GL_LINEAR_MIPMAP_NEAREST));
86   scm_c_define ("GL_NEAREST", scm_from_int (GL_NEAREST));
87
88   // glPush/PopAttrib bits
89   scm_c_define ("GL_DEPTH_BUFFER_BIT", scm_from_int (GL_DEPTH_BUFFER_BIT));
90   scm_c_define ("GL_COLOR_BUFFER_BIT", scm_from_int (GL_COLOR_BUFFER_BIT));
91
92   // OpenGL 1.2
93   scm_c_define ("GL_BGR", scm_from_int (GL_BGR));
94   scm_c_define ("GL_BGRA", scm_from_int (GL_BGRA));
95
96
97   scm_c_define_gsubr ("glBegin", 1, 0, 0, gacela_glBegin);
98
99   return NULL;
100 }