c16d701d9afc391aa17da399e14cbf16efa70592
[chaz/yoink] / src / Moof / OpenGL.hh
1
2 /*******************************************************************************
3
4 Copyright (c) 2009, Charles McGarvey
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9
10 * Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer.
12 * Redistributions in binary form must reproduce the above copyright notice,
13 this list of conditions and the following disclaimer in the documentation
14 and/or other materials provided with the distribution.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27 *******************************************************************************/
28
29 #ifndef _MOOF_OPENGL_HH_
30 #define _MOOF_OPENGL_HH_
31
32 #include <SDL/SDL_opengl.h>
33
34 #if HAVE_CONFIG_H
35 #include "config.h"
36 #endif
37
38
39 #if USE_DOUBLE_PRECISION
40
41 typedef GLdouble GLscalar;
42 #define GL_SCALAR GL_DOUBLE
43 #define SCALAR(D) D
44
45 inline void glGetScalarv(GLenum a, GLscalar* b)
46 { glGetDoublev(a, b); }
47
48 inline void glLoadMatrix(const GLscalar* a)
49 { glLoadMatrixd(a); }
50 inline void glMultMatrix(const GLscalar* a)
51 { glMultMatrixd(a); }
52
53 inline void glScale(GLscalar a, GLscalar b, GLscalar c)
54 { glScaled(a, b, c); }
55 inline void glRotate(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
56 { glRotated(a, b, c, d); }
57 inline void glTranslate(GLscalar a, GLscalar b, GLscalar c)
58 { glTranslated(a, b, c); }
59
60 inline void glColor3(GLscalar a, GLscalar b, GLscalar c)
61 { glColor3d(a, b, c); }
62 inline void glColor4(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
63 { glColor4d(a, b, c, d); }
64 inline void glColor3v(const GLscalar *a)
65 { glColor3dv(a); }
66 inline void glColor4v(const GLscalar *a)
67 { glColor4dv(a); }
68
69 inline void glVertex2(GLscalar a, GLscalar b)
70 { glVertex2d(a, b); }
71 inline void glVertex3(GLscalar a, GLscalar b, GLscalar c)
72 { glVertex3d(a, b, c); }
73 inline void glVertex4(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
74 { glVertex4d(a, b, c, d); }
75 inline void glVertex2v(const GLscalar* a)
76 { glVertex2dv(a); }
77 inline void glVertex3v(const GLscalar* a)
78 { glVertex3dv(a); }
79 inline void glVertex4v(const GLscalar* a)
80 { glVertex4dv(a); }
81
82 inline void glTexCoord2(GLscalar a, GLscalar b)
83 { glTexCoord2d(a, b); }
84 inline void glTexCoord3(GLscalar a, GLscalar b, GLscalar c)
85 { glTexCoord3d(a, b, c); }
86 inline void glTexCoord4(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
87 { glTexCoord4d(a, b, c, d); }
88 inline void glTexCoord2v(const GLscalar* a)
89 { glTexCoord2dv(a); }
90 inline void glTexCoord3v(const GLscalar* a)
91 { glTexCoord3dv(a); }
92 inline void glTexCoord4v(const GLscalar* a)
93 { glTexCoord4dv(a); }
94
95 #else
96
97 typedef GLfloat GLscalar;
98 #define GL_SCALAR GL_FLOAT
99 #define SCALAR(F) F##f
100
101 inline void glGetScalarv(GLenum a, GLscalar* b)
102 { glGetFloatv(a, b); }
103
104 inline void glLoadMatrix(const GLscalar* a)
105 { glLoadMatrixf(a); }
106 inline void glMultMatrix(const GLscalar* a)
107 { glMultMatrixf(a); }
108
109 inline void glScale(GLscalar a, GLscalar b, GLscalar c)
110 { glScalef(a, b, c); }
111 inline void glRotate(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
112 { glRotatef(a, b, c, d); }
113 inline void glTranslate(GLscalar a, GLscalar b, GLscalar c)
114 { glTranslatef(a, b, c); }
115
116 inline void glColor3(GLscalar a, GLscalar b, GLscalar c)
117 { glColor3f(a, b, c); }
118 inline void glColor4(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
119 { glColor4f(a, b, c, d); }
120 inline void glColor3v(const GLscalar *a)
121 { glColor3fv(a); }
122 inline void glColor4v(const GLscalar *a)
123 { glColor4fv(a); }
124
125 inline void glVertex2(GLscalar a, GLscalar b)
126 { glVertex2f(a, b); }
127 inline void glVertex3(GLscalar a, GLscalar b, GLscalar c)
128 { glVertex3f(a, b, c); }
129 inline void glVertex4(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
130 { glVertex4f(a, b, c, d); }
131 inline void glVertex2v(const GLscalar* a)
132 { glVertex2fv(a); }
133 inline void glVertex3v(const GLscalar* a)
134 { glVertex3fv(a); }
135 inline void glVertex4v(const GLscalar* a)
136 { glVertex4fv(a); }
137
138 inline void glTexCoord2(GLscalar a, GLscalar b)
139 { glTexCoord2f(a, b); }
140 inline void glTexCoord3(GLscalar a, GLscalar b, GLscalar c)
141 { glTexCoord3f(a, b, c); }
142 inline void glTexCoord4(GLscalar a, GLscalar b, GLscalar c, GLscalar d)
143 { glTexCoord4f(a, b, c, d); }
144 inline void glTexCoord2v(const GLscalar* a)
145 { glTexCoord2fv(a); }
146 inline void glTexCoord3v(const GLscalar* a)
147 { glTexCoord3fv(a); }
148 inline void glTexCoord4v(const GLscalar* a)
149 { glTexCoord4fv(a); }
150
151 #endif
152
153
154 #endif // _MOOF_OPENGL_HH_
155
156 /** vim: set ts=4 sw=4 tw=80: *************************************************/
157
This page took 0.035567 seconds and 3 git commands to generate.