util.c
Go to the documentation of this file.
1 /*
2  * $Header$
3  */
4 
5 #include <GL/gl.h>
6 #include <GL/glu.h>
7 #include <GL/glx.h>
8 #include "util.h"
9 
10 struct tessinfo {
11  GLdouble vert[3];
12  GLint tp;
13  GLdouble tcoord[2];
14  GLint np;
15  GLdouble ncoord[3];
16 };
17 
19  eusfloat_t v[4];
20 {
21  glClearColor((GLclampf)v[0], (GLclampf)v[1], (GLclampf)v[2], (GLclampf)v[3]);
22 }
23 
24 void glOrtho6f(left, right, bottom, top, near, far)
25  eusfloat_t left;
26  eusfloat_t right;
27  eusfloat_t bottom;
28  eusfloat_t top;
29  eusfloat_t near;
30  eusfloat_t far;
31 {
32  glOrtho((GLdouble)left, (GLdouble)right, (GLdouble)bottom, (GLdouble)top,
33  (GLdouble)near, (GLdouble)far);
34 }
35 
36 void glOrthofv(v)
37  eusfloat_t v[6];
38 {
39  glOrtho((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2], (GLdouble)v[3],
40  (GLdouble)v[4], (GLdouble)v[5]);
41 }
42 
44  eusfloat_t v[4];
45 {
46  glRotatef((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]);
47 }
48 
50  eusfloat_t v[3];
51 {
52  glTranslatef((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]);
53 }
54 
55 
56 void glClipPlanef(pl, eqn)
57  eusinteger_t pl;
58  eusfloat_t eqn[4];
59 {
60  GLdouble d_eqn[4];
61 
62  d_eqn[0] = eqn[0];
63  d_eqn[1] = eqn[1];
64  d_eqn[2] = eqn[2];
65  d_eqn[3] = eqn[3];
66 
67  glClipPlane((GLenum)pl, d_eqn);
68 }
69 
71  eusfloat_t v[4];
72 {
73  gluPerspective((GLdouble)v[0], (GLdouble)v[1],
74  (GLdouble)v[2], (GLdouble)v[3]);
75 }
76 
78  eusfloat_t v[9];
79 {
80  gluLookAt((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2],
81  (GLdouble)v[3], (GLdouble)v[4], (GLdouble)v[5],
82  (GLdouble)v[6], (GLdouble)v[7], (GLdouble)v[8]);
83 }
84 
85 void gluTessCallbackl(tobj, which, fn, fn2)
86  eusinteger_t *tobj;
87  eusinteger_t which;
88  eusinteger_t fn;
89  eusinteger_t fn2;
90 {
91  eusinteger_t addr = fn << 2;
92  if ( fn2 != 0 ) addr = addr | (fn2 & 0x0000ffff);
93  gluTessCallback((GLUtriangulatorObj *)tobj, (GLenum)which,
94  (void (*)()) ( addr ));
95 }
96 
98  eusfloat_t v[4];
99 {
100  glClearAccum((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3]);
101 }
102 
103 void glAccumfv(op, v)
104  eusinteger_t op;
105  eusfloat_t v[1];
106 {
107  glAccum((GLenum)op, (GLfloat)v[0]);
108 }
109 
110 void gluDiskfv(qobj, v)
111  eusinteger_t qobj;
112  eusfloat_t v[4];
113 {
114  gluDisk((GLUquadricObj *)qobj, (GLdouble)v[0], (GLdouble)v[1],
115  (GLint)v[2], (GLint)v[3]);
116 }
117 
118 void gluPartialDiskfv(qobj, v)
119  eusinteger_t *qobj;
120  eusfloat_t v[6];
121 {
122  gluPartialDisk((GLUquadricObj *)qobj, (GLdouble)v[0], (GLdouble)v[1],
123  (GLint)v[2], (GLint)v[3], (GLdouble)v[4], (GLdouble)v[5]);
124 }
125 
127  eusfloat_t v[3];
128 {
129  glScalef((GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2]);
130 }
131 
132 void gluNurbsPropertyfv(nobj, property, value)
133  eusinteger_t nobj;
134  eusinteger_t property;
135  eusfloat_t *value;
136 {
137  gluNurbsProperty((GLUnurbsObj *)nobj, (GLenum)property, (GLfloat)*value);
138 }
139 
141  eusfloat_t v[6];
142 {
143  glMapGrid2f((GLint)v[0], (GLfloat)v[1], (GLfloat)v[2],
144  (GLint)v[3], (GLfloat)v[4], (GLfloat)v[5]);
145 }
146 
147 void glBitmapfv(w, h, v, b)
148  eusinteger_t w;
149  eusinteger_t h;
150  eusfloat_t v[4];
151  eusinteger_t b;
152 {
153  glBitmap((GLsizei)w, (GLsizei)h,
154  (GLfloat)v[0], (GLfloat)v[1], (GLfloat)v[2], (GLfloat)v[3],
155  (GLubyte *)b);
156 }
157 
158 void glMap1fv(target, args, points)
159  eusinteger_t target;
160  eusfloat_t args[4];
161  eusinteger_t points;
162 {
163  glMap1f((GLenum)target, (GLfloat)args[0], (GLfloat)args[1],
164  (GLint)args[2], (GLint)args[3], (GLfloat *)points);
165 }
166 
167 void glMap2fv(target, args, points)
168  eusinteger_t target;
169  eusfloat_t args[8];
170  eusinteger_t points;
171 {
172  glMap2f((GLenum)target,
173  (GLfloat)args[0], (GLfloat)args[1], (GLint)args[2], (GLint)args[3],
174  (GLfloat)args[4], (GLfloat)args[5], (GLint)args[6], (GLint)args[7],
175  (GLfloat *)points);
176 }
177 
179  eusfloat_t v[6];
180 {
181  glFrustum((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2],
182  (GLdouble)v[3], (GLdouble)v[4], (GLdouble)v[5]);
183 }
184 
186  eusfloat_t v[4];
187 {
188  gluOrtho2D((GLdouble)v[0], (GLdouble)v[1], (GLdouble)v[2], (GLdouble)v[3]);
189 }
190 
192  eusfloat_t v[1];
193 {
194  glPointSize((GLfloat)v[0]);
195 }
196 
198  eusfloat_t v[1];
199 {
200  glClearIndex((GLfloat)v[0]);
201 }
202 
204  eusfloat_t vert[3];
206  eusfloat_t tcoord[2];
208  eusfloat_t ncoord[2];
209 {
210  struct tessinfo *i;
211  int len = sizeof (struct tessinfo);
212 
213  if (!(i = (void *) malloc(len))) {
214  perror("alloctessinfo: malloc");
215  exit(1);
216  }
217 
218 #if 0
219  printf("alloctessinfo: received vert: %05.3f %05.3f %05.3f tcoord[%d]: %05.3f %05.3f ncoord[%d]: %05.3f %05.3f %05.3f\n",
220  vert[0], vert[1], vert[2],
221  tp, tcoord[0], tcoord[1],
222  np, ncoord[0], ncoord[1], ncoord[2]);
223 #endif
224 
225  bzero(i, len);
226 
227  i->vert[0] = (GLdouble)vert[0];
228  i->vert[1] = (GLdouble)vert[1];
229  i->vert[2] = (GLdouble)vert[2];
230 
231  if (i->tp = tp) {
232  i->tcoord[0] = (GLdouble)tcoord[0];
233  i->tcoord[1] = (GLdouble)tcoord[1];
234  }
235 
236  if (i->np = np) {
237  i->ncoord[0] = (GLdouble)ncoord[0];
238  i->ncoord[1] = (GLdouble)ncoord[1];
239  i->ncoord[2] = (GLdouble)ncoord[2];
240  }
241 
242  return (eusinteger_t)i;
243 }
244 
246  eusinteger_t i;
247 {
248  glVertex3dv(((struct tessinfo *)i)->vert);
249  if (((struct tessinfo *)i)->tp)
250  glTexCoord2dv(((struct tessinfo *)i)->tcoord);
251 }
252 
253 void glDepthRangefv(clamp)
254  eusfloat_t clamp[2];
255 {
256  glDepthRange((GLclampd)clamp[0], (GLclampd)clamp[1]);
257 }
258 
259 #if 0 /* GL_EXT_polygon_offset */
261  eusfloat_t v[2];
262 {
263  glPolygonOffsetEXT((GLfloat)v[0], (GLfloat)v[1]);
264 }
265 #endif
266 
267 #if (WORD_SIZE == 64)
268 void glPointSized (double d) {
269  glPointSize((float)d);
270 }
271 void glLineWidthd (double d) {
272  glLineWidth((float)d);
273 }
274 void gluNurbsPropertyd(GLUnurbs* nurb, GLenum property, double value) {
275  gluNurbsProperty(nurb, property, (GLfloat)value);
276 }
277 #endif
d
void glPolygonOffsetEXTfv()
void glOrtho6f(eusfloat_t left, eusfloat_t right, eusfloat_t bottom, eusfloat_t top, eusfloat_t near, eusfloat_t far)
Definition: util.c:24
GLint np
Definition: util.c:14
void glClearAccumfv(v)
Definition: util.c:97
void glRotatefv(v)
Definition: util.c:43
void glTranslatefv(v)
Definition: util.c:49
void gluPerspectivefv(v)
Definition: util.c:70
Definition: util.c:10
void glMapGrid2fv(v)
Definition: util.c:140
void glBitmapfv(eusinteger_t w, eusinteger_t h, v, eusinteger_t b)
Definition: util.c:147
void gluNurbsPropertyfv(eusinteger_t nobj, eusinteger_t property, eusfloat_t *value)
Definition: util.c:132
GLint tp
Definition: util.c:12
void glClearColorfv(v)
Definition: util.c:18
void glClipPlanef(eusinteger_t pl, eqn)
Definition: util.c:56
void gluPartialDiskfv(eusinteger_t *qobj, v)
Definition: util.c:118
void tess_vertex_cb(eusinteger_t i)
Definition: util.c:245
void gluDiskfv(eusinteger_t qobj, v)
Definition: util.c:110
void glFrustumfv(v)
Definition: util.c:178
void glScalefv(v)
Definition: util.c:126
void glAccumfv(eusinteger_t op, v)
Definition: util.c:103
GLdouble tcoord[2]
Definition: util.c:13
void gluLookAtfv(v)
Definition: util.c:77
void glMap2fv(eusinteger_t target, args, eusinteger_t points)
Definition: util.c:167
long eusinteger_t
Definition: eus.h:19
GLdouble ncoord[3]
Definition: util.c:15
void glOrthofv(v)
Definition: util.c:36
void gluOrtho2Dfv(v)
Definition: util.c:185
void glClearIndexfv(v)
Definition: util.c:197
void glMap1fv(eusinteger_t target, args, eusinteger_t points)
Definition: util.c:158
GLfloat v[8][3]
Definition: cube.c:21
void glPointSizefv(v)
Definition: util.c:191
eusinteger_t alloctessinfo(vert, eusinteger_t tp, tcoord, eusinteger_t np, ncoord)
Definition: util.c:203
double eusfloat_t
Definition: eus.h:20
GLdouble vert[3]
Definition: util.c:11
void glDepthRangefv(clamp)
Definition: util.c:253
void gluTessCallbackl(eusinteger_t *tobj, eusinteger_t which, eusinteger_t fn, eusinteger_t fn2)
Definition: util.c:85


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 6 2019 20:00:44