Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GLUP_private.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2000-2022 Inria
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * * Neither the name of the ALICE Project-Team nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Contact: Bruno Levy
30  *
31  * https://www.inria.fr/fr/bruno-levy
32  *
33  * Inria,
34  * Domaine de Voluceau,
35  * 78150 Le Chesnay - Rocquencourt
36  * FRANCE
37  *
38  */
39 
40 #ifndef GEOGRAM_GFX_GLUP_GLUP_PRIVATE
41 #define GEOGRAM_GFX_GLUP_GLUP_PRIVATE
42 
43 #include <geogram_gfx/GLUP/GLUP.h>
45 
53 namespace GLUP {
54  using namespace GEO;
55  extern GLUP_API Context* current_context_;
56 }
57 
58 inline void glupPrivateBegin(GLUPprimitive primitive) {
59  GLUP::current_context_->begin(primitive);
60 }
61 
62 inline void glupPrivateEnd() {
63  GLUP::current_context_->end();
64 }
65 
66 inline void glupPrivateVertex2fv(const GLUPfloat* xy) {
67  GLUP::current_context_->immediate_vertex(xy[0], xy[1]);
68 }
69 
70 inline void glupPrivateVertex3fv(const GLUPfloat* xyz) {
71  GLUP::current_context_->immediate_vertex(xyz[0], xyz[1], xyz[2]);
72 }
73 
74 inline void glupPrivateVertex4fv(const GLUPfloat* xyzw) {
75  GLUP::current_context_->immediate_vertex(
76  xyzw[0], xyzw[1], xyzw[2], xyzw[3]
77  );
78 }
79 
80 inline void glupPrivateVertex2dv(const GLUPdouble* xy) {
81  GLUP::current_context_->immediate_vertex(
82  GLfloat(xy[0]),
83  GLfloat(xy[1])
84  );
85 }
86 
87 inline void glupPrivateVertex3dv(const GLUPdouble* xyz) {
88  GLUP::current_context_->immediate_vertex(
89  GLfloat(xyz[0]),
90  GLfloat(xyz[1]),
91  GLfloat(xyz[2])
92  );
93 }
94 
95 inline void glupPrivateVertex4dv(const GLUPdouble* xyzw) {
96  GLUP::current_context_->immediate_vertex(
97  GLfloat(xyzw[0]),
98  GLfloat(xyzw[1]),
99  GLfloat(xyzw[2]),
100  GLfloat(xyzw[3])
101  );
102 }
103 
104 inline void glupPrivateVertex2f(GLUPfloat x, GLUPfloat y) {
105  GLUP::current_context_->immediate_vertex(x,y);
106 }
107 
108 inline void glupPrivateVertex3f(GLUPfloat x, GLUPfloat y, GLUPfloat z) {
109  GLUP::current_context_->immediate_vertex(x,y,z);
110 }
111 
112 inline void glupPrivateVertex4f(
113  GLUPfloat x, GLUPfloat y, GLUPfloat z, GLUPfloat w
114 ) {
115  GLUP::current_context_->immediate_vertex(x,y,z,w);
116 }
117 
118 inline void glupPrivateVertex2d(GLUPdouble x, GLUPdouble y) {
119  GLUP::current_context_->immediate_vertex(
120  GLfloat(x),
121  GLfloat(y)
122  );
123 }
124 
125 inline void glupPrivateVertex3d(GLUPdouble x, GLUPdouble y, GLUPdouble z) {
126  GLUP::current_context_->immediate_vertex(
127  GLfloat(x),
128  GLfloat(y),
129  GLfloat(z)
130  );
131 }
132 
133 inline void glupPrivateVertex4d(
134  GLUPdouble x, GLUPdouble y, GLUPdouble z, GLUPdouble w
135 ) {
136  GLUP::current_context_->immediate_vertex(
137  GLfloat(x),
138  GLfloat(y),
139  GLfloat(z),
140  GLfloat(w)
141  );
142 }
143 
144 inline void glupPrivateColor3fv(const GLUPfloat* rgb) {
145  GLUP::current_context_->immediate_color(rgb[0], rgb[1], rgb[2]);
146 }
147 
148 inline void glupPrivateColor4fv(const GLUPfloat* rgba) {
149  GLUP::current_context_->immediate_color(rgba[0], rgba[1], rgba[2], rgba[3]);
150 }
151 
152 inline void glupPrivateColor3dv(const GLUPdouble* rgb) {
153  GLUP::current_context_->immediate_color(
154  GLfloat(rgb[0]),
155  GLfloat(rgb[1]),
156  GLfloat(rgb[2])
157  );
158 }
159 
160 inline void glupPrivateColor4dv(const GLUPdouble* rgba) {
161  GLUP::current_context_->immediate_color(
162  GLfloat(rgba[0]),
163  GLfloat(rgba[1]),
164  GLfloat(rgba[2]),
165  GLfloat(rgba[3])
166  );
167 }
168 
169 inline void glupPrivateColor3f(GLUPfloat r, GLUPfloat g, GLUPfloat b) {
170  GLUP::current_context_->immediate_color(r, g, b);
171 }
172 
173 inline void glupPrivateColor4f(
174  GLUPfloat r, GLUPfloat g, GLUPfloat b, GLUPfloat a
175 ) {
176  GLUP::current_context_->immediate_color(r, g, b, a);
177 }
178 
179 inline void glupPrivateColor3d(GLUPdouble r, GLUPdouble g, GLUPdouble b) {
180  GLUP::current_context_->immediate_color(
181  GLfloat(r),
182  GLfloat(g),
183  GLfloat(b)
184  );
185 }
186 
187 inline void glupPrivateColor4d(
188  GLUPdouble r, GLUPdouble g, GLUPdouble b, GLUPdouble a
189 ) {
190  GLUP::current_context_->immediate_color(
191  GLfloat(r),
192  GLfloat(g),
193  GLfloat(b),
194  GLfloat(a)
195  );
196 }
197 
198 inline void glupPrivateTexCoord2fv(const GLUPfloat* st) {
199  GLUP::current_context_->immediate_tex_coord(st[0], st[1]);
200 }
201 
202 inline void glupPrivateTexCoord3fv(const GLUPfloat* stu) {
203  GLUP::current_context_->immediate_tex_coord(stu[0], stu[1], stu[2]);
204 }
205 
206 inline void glupPrivateTexCoord4fv(const GLUPfloat* stuv) {
207  GLUP::current_context_->immediate_tex_coord(
208  stuv[0], stuv[1], stuv[2], stuv[3]
209  );
210 }
211 
212 inline void glupPrivateTexCoord2dv(const GLUPdouble* st) {
213  GLUP::current_context_->immediate_tex_coord(
214  GLfloat(st[0]),
215  GLfloat(st[1])
216  );
217 }
218 
219 inline void glupPrivateTexCoord3dv(const GLUPdouble* stu) {
220  GLUP::current_context_->immediate_tex_coord(
221  GLfloat(stu[0]),
222  GLfloat(stu[1]),
223  GLfloat(stu[2])
224  );
225 }
226 
227 inline void glupPrivateTexCoord4dv(const GLUPdouble* stuv) {
228  GLUP::current_context_->immediate_tex_coord(
229  GLfloat(stuv[0]),
230  GLfloat(stuv[1]),
231  GLfloat(stuv[2]),
232  GLfloat(stuv[3])
233  );
234 }
235 
236 inline void glupPrivateTexCoord1f(GLUPfloat s) {
237  GLUP::current_context_->immediate_tex_coord(s);
238 }
239 
240 inline void glupPrivateTexCoord2f(GLUPfloat s, GLUPfloat t) {
241  GLUP::current_context_->immediate_tex_coord(s,t);
242 }
243 
244 inline void glupPrivateTexCoord3f(GLUPfloat s, GLUPfloat t, GLUPfloat u) {
245  GLUP::current_context_->immediate_tex_coord(s,t,u);
246 }
247 
248 inline void glupPrivateTexCoord4f(
249  GLUPfloat s, GLUPfloat t, GLUPfloat u, GLUPfloat v
250 ) {
251  GLUP::current_context_->immediate_tex_coord(s,t,u,v);
252 }
253 
254 inline void glupPrivateTexCoord1d(GLUPdouble s) {
255  GLUP::current_context_->immediate_tex_coord(
256  GLfloat(s)
257  );
258 }
259 
260 inline void glupPrivateTexCoord2d(GLUPdouble s, GLUPdouble t) {
261  GLUP::current_context_->immediate_tex_coord(
262  GLfloat(s),
263  GLfloat(t)
264  );
265 }
266 
267 inline void glupPrivateTexCoord3d(GLUPdouble s, GLUPdouble t, GLUPdouble u) {
268  GLUP::current_context_->immediate_tex_coord(
269  GLfloat(s),
270  GLfloat(t),
271  GLfloat(u)
272  );
273 }
274 
275 inline void glupPrivateTexCoord4d(
276  GLUPdouble s, GLUPdouble t, GLUPdouble u, GLUPdouble v
277 ) {
278  GLUP::current_context_->immediate_tex_coord(
279  GLfloat(s),
280  GLfloat(t),
281  GLfloat(u),
282  GLfloat(v)
283  );
284 }
285 
286 
287 inline void glupPrivateNormal3fv(GLUPfloat* xyz) {
288  GLUP::current_context_->immediate_normal(
289  xyz[0],xyz[1],xyz[2]
290  );
291 }
292 
293 inline void glupPrivateNormal3f(GLUPfloat x, GLUPfloat y, GLUPfloat z) {
294  GLUP::current_context_->immediate_normal(
295  x,y,z
296  );
297 }
298 
299 inline void glupPrivateNormal3dv(GLUPdouble* xyz) {
300  GLUP::current_context_->immediate_normal(
301  GLfloat(xyz[0]),
302  GLfloat(xyz[1]),
303  GLfloat(xyz[2])
304  );
305 }
306 
307 inline void glupPrivateNormal3d(GLUPdouble x, GLUPdouble y, GLUPdouble z) {
308  GLUP::current_context_->immediate_normal(
309  GLfloat(x),
310  GLfloat(y),
311  GLfloat(z)
312  );
313 }
314 
315 #endif
GLUP: GL Useful Primitives.
GLUPprimitive
Symbolic values corresponding to GLUP primitive types.
Definition: GLUP.h:470
Internal implementation of GLUP context.
void immediate_color(GLfloat r, GLfloat g, GLfloat b, GLfloat a=1.0f)
Specifies the current color for the immediate mode buffers.
void immediate_vertex(GLfloat x, GLfloat y, GLfloat z=0.0f, GLfloat w=1.0f)
Creates a new vertex in the immediate mode buffers.
virtual void begin(GLUPprimitive primitive)
Begins rendering in immediate mode.
void immediate_normal(GLfloat x, GLfloat y, GLfloat z)
Specifies the current normal vector for the immediate mode buffers.
void immediate_tex_coord(GLfloat s, GLfloat t=0.0f, GLfloat u=0.0f, GLfloat v=1.0f)
Specifies the current texture coordinates for the immediate mode buffers.
virtual void end()
Ends rendering in immediate mode.
Global Vorpaline namespace.
Definition: basic.h:55